@@ -73,14 +73,9 @@ function exec(nodemonOptions, execMap) {
73
73
var options = utils . clone ( nodemonOptions || { } ) ;
74
74
var script = path . basename ( options . script || '' ) ;
75
75
var scriptExt = path . extname ( script ) . slice ( 1 ) ;
76
- var extension = options . ext || scriptExt || 'js' ;
76
+ var extension = options . ext || scriptExt || 'js,json ' ;
77
77
var execDefined = ! ! options . exec ;
78
78
79
- // strip any leading periods int he extension
80
- if ( extension . indexOf ( '.' ) === 0 ) {
81
- extension = extension . slice ( 1 ) ;
82
- }
83
-
84
79
// allows the user to simplify cli usage:
85
80
// https://github.com/remy/nodemon/issues/195
86
81
// but always give preference to the user defined argument
@@ -146,7 +141,7 @@ function exec(nodemonOptions, execMap) {
146
141
if ( options . exec === 'coffee' ) {
147
142
// don't override user specified extension tracking
148
143
if ( ! options . ext ) {
149
- extension = 'coffee litcoffee js json' ;
144
+ extension = 'coffee, litcoffee,js, json' ;
150
145
}
151
146
152
147
// because windows can't find 'coffee', it needs the real file 'coffee.cmd'
@@ -156,22 +151,11 @@ function exec(nodemonOptions, execMap) {
156
151
}
157
152
158
153
// allow users to make a mistake on the extension to monitor
159
- // converts js,jade => js,jade
160
- // and 'js jade' => js,jade
154
+ // converts .js, jade => js,jade
161
155
// BIG NOTE: user can't do this: nodemon -e *.js
162
156
// because the terminal will automatically expand the glob against
163
157
// the file system :(
164
- if ( extension . indexOf ( ' ' ) !== - 1 ||
165
- extension . indexOf ( ',' ) !== - 1 ||
166
- extension . indexOf ( '*.' ) !== - 1 ) {
167
-
168
- extension = extension . replace ( / \s + / g, '|' ) // convert spaces to pipes
169
- . replace ( / , / g, '|' ) // convert commas to pipes
170
- . split ( '|' ) // split on those pipes
171
- . map ( function ( item ) {
172
- return item . replace ( / ^ [ \* \. ] + / , '' ) ; // remove "*."
173
- } ) . join ( ',' ) ; // return regexp string like: js,jade
174
- }
158
+ extension = extension . match ( / \w + / g) . join ( ',' ) ;
175
159
176
160
options . ext = extension ;
177
161
0 commit comments