I have just started using Ionic and am trying to modify the gulpfile to watch for js in folders like js/controllers
js/services
etc so I can split up everything for angular into their own folders and have everything concatenated into one js file to include in index.html
The gulp task I made for this is:
gulp.task('scripts', function() {
return gulp.src('./www/js/**/*.js')
.pipe(concat('app.js'))
.pipe(gulp.dest('dist/js/'))
.pipe(rename('app.min.js'))
});
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.js, ['scripts']);
});
This is concatenating all the js into one file but everytime the watcher is trigger it duplicates all the javascript.
How can I get around this?