Created
February 3, 2014 08:17
-
-
Save yocontra/8780398 to your computer and use it in GitHub Desktop.
http://www.100percentjs.com/just-like-grunt-gulp-browserify-now/ rewritten with best practices
This file contains hidden or 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
var gulp = require('gulp'); | |
var browserify = require('gulp-browserify'); | |
var concat = require('gulp-concat'); | |
var styl = require('gulp-styl'); | |
var refresh = require('gulp-livereload'); | |
var lr = require('tiny-lr'); | |
var server = lr(); | |
var paths = { | |
js: 'src/**/*.js', | |
styles: 'css/**/*.css' | |
}; | |
gulp.task('scripts', function () { | |
return gulp.src(paths.js) | |
.pipe(browserify()) | |
.pipe(concat('dest.js')) | |
.pipe(gulp.dest('build')) | |
.pipe(refresh(server)); | |
}); | |
gulp.task('styles', function () { | |
return gulp.src(paths.styles) | |
.pipe(styl({ | |
compress: true | |
})) | |
.pipe(gulp.dest('build')) | |
.pipe(refresh(server)); | |
}); | |
gulp.task('lr-server', function (cb) { | |
server.listen(35729, cb); | |
}); | |
gulp.task('watch', function () { | |
gulp.watch(paths.js, ['scripts']); | |
gulp.watch(paths.styles, ['styles']); | |
}); | |
gulp.task('default', ['lr-server', 'scripts', 'styles', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment