Skip to content

Instantly share code, notes, and snippets.

@garrows
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garrows/9501339 to your computer and use it in GitHub Desktop.
Save garrows/9501339 to your computer and use it in GitHub Desktop.
Gulp watch with LiveReload
var gulp = require('gulp'),
compress = require('gulp-uglify'),
stylus = require('gulp-stylus'),
concat = require('gulp-concat'),
browserify = require('gulp-browserify'),
livereload = require('gulp-livereload');
var liveReloadServer = livereload();
gulp.task('styles', function() {
gulp.src('./styles/index.styl')
.pipe(stylus({
compress: true
}))
.pipe(gulp.dest('./styles'))
.pipe(livereload())
});
gulp.task('build', function() {
gulp.src(['./scripts/app.js'])
.pipe(browserify({
debug : false
}))
//.pipe(compress())
.pipe(concat('../build/app.browser.js'))
.pipe(gulp.dest('./scripts'))
.pipe(livereload())
});
//Works well with this https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei
gulp.task('watch', function() {
gulp.watch(['./styles/**/*.styl'], ['styles']);
gulp.watch(['./scripts/**/*.js'], ['build']);
});
gulp.task('default', ['styles', 'build', 'watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment