Skip to content

Instantly share code, notes, and snippets.

@acroix
Created July 4, 2014 10:14
Show Gist options
  • Save acroix/f58ca6b16d4fa85d5848 to your computer and use it in GitHub Desktop.
Save acroix/f58ca6b16d4fa85d5848 to your computer and use it in GitHub Desktop.
gulp file to restart node and browserify
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var nodemon = require('gulp-nodemon');
var dirname = 'src/public';
var paths = {
apps: ['src/apps/desktop/main.js'],
dist: 'src/public/dist'
}
gulp.task('develop',function() {
nodemon({ script: 'server.js', ext: 'html js', ignore: paths.dist + '/**' })
.on('start', ['browserify'])
.on('restart', ['browserify'], function () {
console.log('restarted!');
});
});
gulp.task('browserify', function() {
gulp.src(paths.apps)
.pipe(browserify({transform: 'reactify'}))
.pipe(concat('main.js'))
.pipe(gulp.dest(paths.dist + '/js'));
});
gulp.task('default',['develop']);
gulp.task('watch', function() {
gulp.watch('src/**/*.*', ['default']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment