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
+31-20
Original file line number
Diff line number
Diff line change
@@ -120,17 +120,23 @@ hook({
120
120
});
121
121
```
122
122
123
-
### `append` array
123
+
### `devMode` boolean
124
124
125
-
Appends custom plugins to the end of the PostCSS pipeline. Since the `require` function is synchronous, you should provide synchronous plugins only.
125
+
Helps you to invalidate cache of all `require` calls. Usually used for the development purpose. Also overrides behavior, imposed by `NODE_ENV` environment variable. For example:
126
126
127
-
### `prepend` array
127
+
```javascript
128
+
hook({
129
+
devMode:false,
130
+
});
131
+
```
128
132
129
-
Prepends custom plugins to the beginning of the PostCSS pipeline. Since the `require` function is synchronous, you should provide synchronous plugins only.
133
+
### `extensions` array
130
134
131
-
### `use` array
135
+
Attach the require hook to additional file extensions (for example `['.scss']`).
132
136
133
-
Provides the full list of PostCSS plugins to the pipeline. Providing this cancels `append`, `prepend`, `createImportedName`, `generateScopedName` options. Synchronous plugins only.
137
+
### `ignore` function|regex|string
138
+
139
+
Provides possibility to exclude particular files from processing. Supports glob and regular expressions syntax. Also you may provide custom function.
134
140
135
141
### `preprocessCss` function
136
142
@@ -163,31 +169,31 @@ hook({
163
169
});
164
170
```
165
171
166
-
### `devMode` boolean
172
+
### `processorOpts` object
167
173
168
-
Helps you to invalidate cache of all `require` calls. Usually used for the development purpose. Also overrides behavior, imposed by `NODE_ENV` environment variable. For example:
174
+
Provides possibility to pass custom options to the [LazyResult instance](https://github.com/postcss/postcss/blob/master/docs/api.md#processorprocesscss-opts). It can be usefull if you want to set the custom parser, for example: [postcss-less](https://github.com/gilt/postcss-less).
175
+
176
+
```javascript
177
+
consthook=require('css-modules-require-hook');
178
+
constlessParser=require('postcss-less').parse;
169
179
170
-
```bash
171
180
hook({
172
-
devMode: false,
181
+
extensions:'.less',
182
+
processorOpts: {parser: lessParser},
173
183
});
174
184
```
175
185
176
-
### `extensions` array
177
-
178
-
Attach the require hook to additional file extensions (for example `['.scss']`).
179
-
180
-
### `ignore` function|regex|string
186
+
### `append` array
181
187
182
-
Provides possibility to exclude particular files from processing. Supports glob and regular expressions syntax. Also you may provide custom function.
188
+
Appends custom plugins to the end of the PostCSS pipeline. Since the `require` function is synchronous, you should provide synchronous plugins only.
183
189
184
-
### `rootDir` string
190
+
### `prepend` array
185
191
186
-
Provides absolute path to the project directory. Providing this will result in better generated class names. It can be obligatory, if you run require hook and build tools (like [css-modulesify](https://github.com/css-modules/css-modulesify)) from different working directories.
192
+
Prepends custom plugins to the beginning of the PostCSS pipeline. Since the `require` function is synchronous, you should provide synchronous plugins only.
187
193
188
-
### `to` string
194
+
### `use` array
189
195
190
-
Provides `to` option to the [LazyResult instance](https://github.com/postcss/postcss/blob/master/docs/api.md#processorprocesscss-opts).
196
+
Provides the full list of PostCSS plugins to the pipeline. Providing this cancels `append`, `prepend`, `createImportedName`, `generateScopedName` options. Synchronous plugins only.
191
197
192
198
### `createImportedName` function
193
199
@@ -224,6 +230,11 @@ hook({
224
230
225
231
Short alias for the [postcss-modules-local-by-default](https://github.com/css-modules/postcss-modules-local-by-default) plugin's option.
226
232
233
+
### `rootDir` string
234
+
235
+
Provides absolute path to the project directory. Providing this will result in better generated class names. It can be obligatory, if you run require hook and build tools (like [css-modulesify](https://github.com/css-modules/css-modulesify)) from different working directories.
236
+
237
+
227
238
## Debugging
228
239
229
240
[debug](https://www.npmjs.com/package/debug) package is used for debugging. So to turn it on simply specify the **DEBUG** environment variable:
0 commit comments