Skip to content

Instantly share code, notes, and snippets.

@uknick
Created August 7, 2017 11:11
Show Gist options
  • Save uknick/438d594e2a4186caf18c74a372674924 to your computer and use it in GitHub Desktop.
Save uknick/438d594e2a4186caf18c74a372674924 to your computer and use it in GitHub Desktop.
gulp with babel auto-watcher
const gulp = require('gulp');
const babel = require('gulp-babel');
// default task set to auto-watch.
gulp.task('default', function () {
gulp.watch('js/*', ['babel']);
});
// babel task
gulp.task('babel', function () {
return gulp.src('js/*')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist'))
});
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-preset-es2015": "^6.24.1",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment