Skip to content

Instantly share code, notes, and snippets.

@tjcelaya
Last active August 29, 2015 14:17
Show Gist options
  • Save tjcelaya/73c54a567928cf7e55bb to your computer and use it in GitHub Desktop.
Save tjcelaya/73c54a567928cf7e55bb to your computer and use it in GitHub Desktop.
Super-simple Gulp task for Browserify (no fancy super-efficient watch here)
'use strict';
var gulp = require('gulp'),
browserify = require('browserify'),
livereload = require('gulp-livereload'),
source = require('vinyl-source-stream');
gulp.task('browserify', function () {
return browserify('./js/src/app.js')
.bundle()
.pipe(source('compiled.js')) // Pass desired output filename to vinyl-source-stream
.pipe(gulp.dest('./js/dist')); // dest takes output dir for compiled bundle
// both lines are necessary :(
});
gulp.task('watch', function (){
livereload.listen();
gulp.watch(['path/to/js'], ['browserify']);
});
gulp.task('default', ['watch']);
@tjcelaya
Copy link
Author

You can use the Chrome Livereload plugin for minimal setup
https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?hl=en

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment