@@ -149,7 +149,7 @@ var fnInject = function (path) {
149149 return gulp . src ( inject . css . concat ( inject . js ) , { read : false } )
150150 . pipe ( plugins . inject ( path , {
151151 addRootSlash : false ,
152- ignorePath : [ '/' , ' build/']
152+ ignorePath : [ '/' , config . build + ' /']
153153 } ) )
154154 . pipe ( gulp . dest ( config . build ) ) ;
155155} ;
@@ -184,6 +184,7 @@ gulp.task('html', ['html:replace'], function () {
184184gulp . task ( 'watch' , [ 'styles:sass' , 'scripts:lint' , 'scripts:html2js' , 'assets:img' , 'vendor:js' , 'vendor:assets' , 'html:inject' ] , function ( ) {
185185 require ( './server.js' ) ( server ) ;
186186
187+ // watch for JS changes
187188 gulp . watch ( config . paths . scripts , function ( event ) {
188189 if ( event . path . lastIndexOf ( '.js' ) === event . path . length - 3 ) {
189190 if ( event . type === 'deleted' ) {
@@ -197,16 +198,20 @@ gulp.task('watch', ['styles:sass', 'scripts:lint', 'scripts:html2js', 'assets:im
197198 } ) ;
198199
199200 // remove deleted JS files from index.html
200- gulp . watch ( ' build/+(app|common)/**/*.js', function ( event ) {
201+ gulp . watch ( config . build + ' /+(app|common)/**/*.js', function ( event ) {
201202 if ( event . type !== 'changed' ) {
202203 return fnInject ( config . paths . html ) . pipe ( plugins . livereload ( server ) ) ;
203204 }
204205 } ) ;
205206
206- gulp . watch ( config . paths . templates , function ( event ) {
207- return fnHtml2Js ( config . paths . templates ) . pipe ( plugins . livereload ( server ) ) ;
207+ // watch AngularJS templates to cache
208+ gulp . watch ( config . app + '/+(app|common)/**' , function ( event ) {
209+ if ( event . path . lastIndexOf ( '.tpl.html' ) === event . path . length - 9 ) {
210+ return fnHtml2Js ( config . paths . templates ) . pipe ( plugins . livereload ( server ) ) ;
211+ }
208212 } ) ;
209213
214+ // watch for SASS changes
210215 gulp . watch ( config . paths . sass , function ( event ) {
211216 if ( event . path . lastIndexOf ( '.scss' ) === event . path . length - 5 ) {
212217 var files = [
0 commit comments