Last active
August 16, 2016 20:18
-
-
Save elcontraption/9608222 to your computer and use it in GitHub Desktop.
Gulp connect/watch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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