@@ -53,7 +53,8 @@ var cli = meow({
5353 'recursive' ,
5454 'source-map-embed' ,
5555 'source-map-contents' ,
56- 'source-comments'
56+ 'source-comments' ,
57+ 'watch'
5758 ] ,
5859 string : [
5960 'functions' ,
@@ -64,8 +65,7 @@ var cli = meow({
6465 'output' ,
6566 'output-style' ,
6667 'precision' ,
67- 'source-map-root' ,
68- 'watch'
68+ 'source-map-root'
6969 ] ,
7070 alias : {
7171 c : 'source-comments' ,
@@ -139,7 +139,7 @@ function getEmitter() {
139139 */
140140
141141function getOptions ( args , options ) {
142- options . src = args [ 0 ] || options . watch ;
142+ options . src = args [ 0 ] ;
143143
144144 if ( args [ 1 ] ) {
145145 options . dest = path . resolve ( process . cwd ( ) , args [ 1 ] ) ;
@@ -161,30 +161,14 @@ function getOptions(args, options) {
161161 */
162162
163163function watch ( options , emitter ) {
164- var watchDir = isSassFile ( options . watch ) ? path . dirname ( path . resolve ( options . watch ) ) : options . watch ,
165- glob = options . recursive ? '**/*.{sass,scss}' : '*.{sass,scss}' ,
166- gaze = new Gaze ( ) ,
167- dir ;
168-
169- if ( watchDir === true ) {
170- dir = [ ] ;
171- } else if ( ! Array . isArray ( watchDir ) ) {
172- dir = [ watchDir ] ;
173- }
174-
175- // only add the src file if it is not already
176- // in the array as the watch path
177- if ( options . watch !== options . src ) {
178- dir . push ( options . src ) ;
179- }
180- dir = dir . map ( function ( d ) {
181- return isSassFile ( d ) ? d : path . join ( d , glob ) ;
182- } ) ;
164+ var glob = options . recursive ? '**/*.{sass,scss}' : '*.{sass,scss}' ;
165+ var src = isSassFile ( options . src ) ? options . src : path . join ( options . src , glob ) ;
166+ var gaze = new Gaze ( ) ;
183167
184- gaze . add ( dir ) ;
168+ gaze . add ( src ) ;
185169 gaze . on ( 'error' , emitter . emit . bind ( emitter , 'error' ) ) ;
186170
187- var graph = grapher . parseDir ( watchDir , { loadPaths : options . includePath } ) ;
171+ var graph = grapher . parseDir ( path . resolve ( path . dirname ( src ) ) , { loadPaths : options . includePath } ) ;
188172
189173 gaze . on ( 'changed' , function ( file ) {
190174 var files = [ file ] ;
0 commit comments