Skip to content

Commit 4b05984

Browse files
committed
refactor and document watch handling
that lonely else statement at the bottom seemed too distant to be conducive to readability
1 parent 9784f7a commit 4b05984

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ var path = require('path');
114114
var postcss = require('postcss');
115115
var processor = postcss(plugins);
116116

117+
// hook for dynamically updating the list of watched files
118+
global.watchCSS = function() {}; // jshint ignore:line
117119
if (argv.watch) {
118120
var watchedFiles = inputFiles;
119121
var watcher = require('chokidar').watch(watchedFiles);
@@ -128,12 +130,9 @@ if (argv.watch) {
128130
watcher.add(files);
129131
watchedFiles = files;
130132
};
131-
} else {
132-
global.watchCSS = function() {}; // jshint ignore:line
133133
}
134134
async.forEach(inputFiles, compile, onError);
135135

136-
137136
function compile(input, fn) {
138137
var output = argv.output;
139138
if (argv.dir) {

0 commit comments

Comments
 (0)