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
To use this tool we require [Node.js v0.12.x](https://github.com/nodejs/node) (or higher).
24
18
25
19
## Installation
26
20
@@ -30,28 +24,45 @@ $ npm i css-modules-require-hook
30
24
31
25
## Usage
32
26
33
-
In this section I've tried to cover the common cases of usage.
27
+
Now, there are two ways to attach hook: manually or using preset file.
34
28
35
-
### Development mode
29
+
The first one allows you to pass options manually after module was required, to make it work. Example:
36
30
37
-
Usually, Node.js caches all the `require` calls by default. In order to invalidate cache for the purpose of development you should set the environment variable `NODE_ENV` to `development`. For example:
Still you can use `devMode` option (see below) to override behavior which is imposed by environment variable.
38
+
// const styles = require('./icon.css');
39
+
```
44
40
45
-
### Basic example
41
+
The second one allows you to move options to separated file `cmrh.conf.js`, which should be located in your working directory (`process.cwd()`) or in its ancestors. Example:
46
42
47
-
Basically to attach the require hook you need to require this module. If you need to adjust it see the tuning section below.
Usually, Node.js caches all the `require` calls by default. In order to invalidate cache for the purpose of development you should set the environment variable `NODE_ENV` to `development`. For example:
59
+
60
+
```bash
61
+
$ NODE_ENV=development node server.js
53
62
```
54
63
64
+
Still you can use `devMode` option (see below) to override behavior which is imposed by environment variable.
0 commit comments