Created
September 15, 2015 18:50
-
-
Save adalinesimonian/e5ad46add94c33b7524e to your computer and use it in GitHub Desktop.
Gulpfile for Babel using gulp-watch built for Node.js 4.0
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
var gulp = require('gulp') | |
var watch = require('gulp-watch') | |
var babel = require('gulp-babel') | |
var plumber = require('gulp-plumber') | |
var libDir = 'lib/' | |
var srcDir = 'src/**/*.es6' | |
function runBabel () { | |
return gulp.src(srcDir) | |
.pipe(plumber(err => console.log(err.stack))) | |
.pipe(babel()) | |
.pipe(plumber.stop()) | |
.pipe(gulp.dest(libDir)) | |
} | |
gulp.task('babel', () => runBabel()) | |
gulp.task('babel-watch', ['babel'], cb => { | |
watch(srcDir, () => | |
runBabel() | |
.pipe(watch(srcDir)) | |
.on('end', cb) | |
) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment