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

How to replace css modules classes in js files without a templator

Open aslanovsergey opened this issue 6 years ago • 1 comments

Hello,

Could you someone please provide an example how to insert generated modules into js files? Using docs I built css modules and I saw examples for html and templators but want to keep my js files clean of special template syntax. In my case I'm building React app and when I converted css into modules I updated import in components to import styles from "./MyComponent.module.css"; and class assignment statements <div className={styles.myClass}>. After transpiling it was turned into { className: MyComponent_module_css_1.default.myClass }. What would be the best approach to replace such generated styles or it's done somehow differently?

aslanovsergey avatar Jul 16 '19 08:07 aslanovsergey

Post title is wrong. He is asking how to use cssmodules in js files wthout templator. Replacing classes in JS is another task in which i am still very interested. How to change css-classes in js files ?

AntonGrekov avatar Apr 11 '20 15:04 AntonGrekov