postcss-modules icon indicating copy to clipboard operation
postcss-modules copied to clipboard

Deeper integration with postcss-loader

Open freshstrangemusic opened this issue 7 years ago • 1 comments

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.

freshstrangemusic avatar Feb 14 '18 05:02 freshstrangemusic

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;

AndyOGo avatar Dec 10 '20 18:12 AndyOGo