Skip to content

Commit 7851fd2

Browse files
committed
added small description to few options
1 parent 02aa110 commit 7851fd2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,33 @@ Provides the full list of PostCSS plugins to the pipeline. Providing this cancel
117117

118118
In rare cases you may want to precompile styles, before they will be passed to the PostCSS pipeline. You should use **synchronous** transformations, since `require` function is synchronous.
119119

120+
```javascript
121+
hook({
122+
/**
123+
* @param {string} css
124+
* @param {string} filepath Absolute path to the file
125+
* @return {string}
126+
*/
127+
preprocessCss: function (css, filepath) {
128+
return css;
129+
}
130+
});
131+
```
132+
120133
### `processCss` function
121134

122135
In rare cases you may want to get compiled styles in runtime, so providing this option helps.
123136

137+
```javascript
138+
hook({
139+
/**
140+
* @param {string} css
141+
* @param {string} filepath Absolute path to the file
142+
*/
143+
processCss: function (css, filepath) { /* */ }
144+
});
145+
```
146+
124147
### `extensions` array
125148

126149
Attach the require hook to additional file extensions (for example `['.scss']`).
@@ -141,6 +164,20 @@ Short alias for the [postcss-modules-extract-imports](https://github.com/css-mod
141164

142165
Short alias for the [postcss-modules-scope](https://github.com/css-modules/postcss-modules-scope) plugin's option. Helps you to specify the custom way to build generic names for the class selectors.
143166

167+
```javascript
168+
hook({
169+
/**
170+
* @param {string} name Usually a class name
171+
* @param {string} filepath
172+
* @param {string} css
173+
* @return {string}
174+
*/
175+
generateScopedName: function (name, filepath, css) {
176+
return name;
177+
}
178+
});
179+
```
180+
144181
### `mode` string
145182

146183
Short alias for the [postcss-modules-local-by-default](https://github.com/css-modules/postcss-modules-local-by-default) plugin's option.

0 commit comments

Comments
 (0)