postcss-modules
postcss-modules copied to clipboard
Deeper integration with postcss-loader
Currently I can't use postcss-modules due to not being able to access the loader context or get the bundle name of the processed file, so I can't generate modules/[name].json for each webpack entrypoint. It would be nice if postcss-modules could detect itself running under postcss-loader and expose the loader context to getJSON.
Alternatively, a way to call getJSON on an entire webpack bundle would be great.
I realize that these issues may be out of scope for this project.
I have the same use case, I want to import the CSS file directly from my JS file, as it works with css-loader, like:
https://github.com/webpack-contrib/css-loader#modules
index.css
.foo {}
.bar {}
index.js
import indexStyles from `./index.css`;
const div = document.createElement('div');
div.className = indexStyles.foo;