Created
August 7, 2017 11:11
-
-
Save uknick/438d594e2a4186caf18c74a372674924 to your computer and use it in GitHub Desktop.
gulp with babel auto-watcher
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
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')) | |
}); |
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
{ | |
"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