Package Exports
- fake-style-loader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fake-style-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fake-style-loader
This works similar to style-loader, except it can be used on the server.
Usage
// in webpack config loaders, for server bundle
{ test: /\.css$/, loader: 'fake-style!css?modules' },
// in webpack config loaders, for client bundle (unrelated to this plugin)
{ test: /\.css$/, loader: 'style!css?modules' },var styles = require('./some-file.css')
console.log(styles)
// returns
// {
// heading: '.XYZABC123',
// ...
// source: '.heading { color: blue; }'
// }
The classnames are returned, just like when using the style-loader and the css-loader in modules mode.
As an added bonus the returned object contains a source property which contains the CSS source code after it has went through css-loader.
As an example, this css source can be inlined into the HTML response on the server.