You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-7Lines changed: 14 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,18 @@ b.bundle();
48
48
### Options:
49
49
50
50
-`rootDir`: absolute path to your project's root directory. This is optional but providing it will result in better generated classnames.
51
-
-`output`: path to write the generated css
52
-
-`use`: optional array of postcss plugins (by default we use the css-modules core plugins)
51
+
-`output`: path to write the generated css.
52
+
-`jsonOutput`: optional path to write a json manifest of classnames.
53
+
-`use`: optional array of postcss plugins (by default we use the css-modules core plugins).
54
+
55
+
## Using CSS Modules on the backend
56
+
57
+
If you want to use CSS Modules in server-generated templates there are a couple of options:
58
+
59
+
- Option A (nodejs only): register the [require-hook](https://github.com/css-modules/css-modules-require-hook) so that `var styles = require('./foo.css')` operates the same way as on the frontend. Make sure that the `rootDir` option matches to guarantee that the classnames are the same.
60
+
61
+
- Option B: configure the `jsonOutput` option with a file path and `css-modulesify` will generate a JSON manifest of classnames.
62
+
53
63
54
64
## PostCSS Plugins
55
65
@@ -70,11 +80,8 @@ In addition you may also wish to configure defined PostCSS plugins by passing `-
0 commit comments