Skip to content

Instantly share code, notes, and snippets.

@elcontraption
Last active August 16, 2016 20:18
Show Gist options
  • Save elcontraption/9608222 to your computer and use it in GitHub Desktop.
Save elcontraption/9608222 to your computer and use it in GitHub Desktop.
Gulp connect/watch
/**
* Start up livereload server
*/
gulp.task('connect', $.connect.server({
root: ['dist'],
port: 8080,
livereload: true
}));
/**
* Watch files for changes
*/
gulp.task('watch', ['connect'], function () {
// watch for changes in 'dist' folder
gulp.watch([
'./dist/assets/scripts/**/*.js',
'./dist/assets/styles/**/*.css',
'./dist/assets/img/**/*',
'./dist/**/*.html'
], function ( event ) {
return gulp.src( event.path )
.pipe($.connect.reload());
});
// 'app' folder
gulp.watch('./app/assets/scripts/**/*.js', ['jshint', 'scripts']);
gulp.watch('./app/assets/styles/**/*.scss', ['styles']);
gulp.watch('./app/**/*.hbs', ['handlebars']);
gulp.watch('./app/assets/img/**/*', ['images']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment