Commit 29871dea by Adeel Mujahid

Merge pull request #515 from kevva/recursive-watch

Add ability to watch for files recursively
parents 491f5fc8 a214ae21
...@@ -23,6 +23,7 @@ var cli = meow({ ...@@ -23,6 +23,7 @@ var cli = meow({
'', '',
'Options', 'Options',
' -w, --watch Watch a directory or file', ' -w, --watch Watch a directory or file',
' -r, --recursive Recursively watch directories or files',
' -o, --output Output CSS file', ' -o, --output Output CSS file',
' -x, --omit-source-map-url Omit source map URL comment from output', ' -x, --omit-source-map-url Omit source map URL comment from output',
' -i, --indented-syntax Treat data from stdin as sass code (versus scss)', ' -i, --indented-syntax Treat data from stdin as sass code (versus scss)',
...@@ -39,6 +40,7 @@ var cli = meow({ ...@@ -39,6 +40,7 @@ var cli = meow({
boolean: [ boolean: [
'indented-syntax', 'indented-syntax',
'omit-source-map-url', 'omit-source-map-url',
'recursive',
'stdout', 'stdout',
'source-comments' 'source-comments'
], ],
...@@ -54,7 +56,8 @@ var cli = meow({ ...@@ -54,7 +56,8 @@ var cli = meow({
o: 'output', o: 'output',
w: 'watch', w: 'watch',
x: 'omit-source-map-url', x: 'omit-source-map-url',
c: 'source-comments' c: 'source-comments',
r: 'recursive'
}, },
default: { default: {
'image-path': '', 'image-path': '',
...@@ -145,7 +148,8 @@ function watch(options, emitter) { ...@@ -145,7 +148,8 @@ function watch(options, emitter) {
dir.push(options.src); dir.push(options.src);
dir = dir.map(function(d) { dir = dir.map(function(d) {
return isSassFile(d) ? d : path.join(d, '*.{sass,scss}'); var glob = options.recursive ? '**/*.{sass,scss}' : '*.{sass,scss}';
return isSassFile(d) ? d : path.join(d, glob);
}); });
gaze.add(dir); gaze.add(dir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment