File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ const debugFetch = require('debug')('css-modules:fetch');
21
21
const debugSetup = require ( 'debug' ) ( 'css-modules:setup' ) ;
22
22
23
23
module . exports = function setupHook ( {
24
+ devMode,
24
25
extensions = '.css' ,
25
26
ignore,
26
27
preprocessCss = identity ,
@@ -39,6 +40,11 @@ module.exports = function setupHook({
39
40
40
41
const tokensByFile = { } ;
41
42
43
+ // debug option is preferred NODE_ENV === 'development'
44
+ const debugMode = typeof devMode !== 'undefined'
45
+ ? devMode
46
+ : process . env . NODE_ENV === 'development' ;
47
+
42
48
let scopedName ;
43
49
if ( generateScopedName ) {
44
50
scopedName = typeof generateScopedName !== 'function'
@@ -67,8 +73,6 @@ module.exports = function setupHook({
67
73
// https://github.com/postcss/postcss#options
68
74
const runner = postcss ( plugins ) ;
69
75
70
- // https://github.com/postcss/postcss/blob/master/docs/api.md#processorprocesscss-opts
71
-
72
76
/**
73
77
* @todo think about replacing sequential fetch function calls with requires calls
74
78
* @param {string } _to
@@ -99,7 +103,7 @@ module.exports = function setupHook({
99
103
100
104
tokens = lazyResult . root . tokens ;
101
105
102
- if ( process . env . NODE_ENV !== 'development' ) {
106
+ if ( ! debugMode ) {
103
107
// updating cache
104
108
tokensByFile [ filename ] = tokens ;
105
109
} else {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const keys = require('lodash').keys;
4
4
5
5
const rules = {
6
6
// hook
7
+ devMode : 'boolean' ,
7
8
extensions : 'array|string' ,
8
9
ignore : 'function|regex|string' ,
9
10
preprocessCss : 'function' ,
@@ -21,6 +22,7 @@ const rules = {
21
22
22
23
const tests = {
23
24
array : require ( 'lodash' ) . isArray ,
25
+ boolean : require ( 'lodash' ) . isBoolean ,
24
26
function : require ( 'lodash' ) . isFunction ,
25
27
regex : require ( 'lodash' ) . isRegExp ,
26
28
string : require ( 'lodash' ) . isString ,
You can’t perform that action at this time.
0 commit comments