Is there a way to create a custom loader that extracts all CSS sources and retrieves their contents in a function? For example:
Webpack configuration
module: {
loaders: [
{test: /\.css$/, loader: 'my-loader'}
]
}
File A (foo.js)
import './foo.css';
File B (bar.js)
import './bar.css';
File C (app.js)
import './app.css';
import getAllCSSContents from 'my-loader';
const css = getAllCSSContents();
The function getAllCSSContents would extract the contents of foo.css, bar.css, and app.css.