Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #515 from kevva/recursive-watch
Browse files Browse the repository at this point in the history
Add ability to watch for files recursively
  • Loading branch information
am11 committed Nov 5, 2014
2 parents 491f5fc + a214ae2 commit 29871de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/node-sass
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var cli = meow({
'',
'Options',
' -w, --watch Watch a directory or file',
' -r, --recursive Recursively watch directories or files',
' -o, --output Output CSS file',
' -x, --omit-source-map-url Omit source map URL comment from output',
' -i, --indented-syntax Treat data from stdin as sass code (versus scss)',
Expand All @@ -39,6 +40,7 @@ var cli = meow({
boolean: [
'indented-syntax',
'omit-source-map-url',
'recursive',
'stdout',
'source-comments'
],
Expand All @@ -54,7 +56,8 @@ var cli = meow({
o: 'output',
w: 'watch',
x: 'omit-source-map-url',
c: 'source-comments'
c: 'source-comments',
r: 'recursive'
},
default: {
'image-path': '',
Expand Down Expand Up @@ -145,7 +148,8 @@ function watch(options, emitter) {

dir.push(options.src);
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);
Expand Down

0 comments on commit 29871de

Please sign in to comment.