Last active
February 20, 2016 07:21
-
-
Save chrisl8888/84c0574c023ce6920b36 to your computer and use it in GitHub Desktop.
Gulp file for Basic Babel (6to5) transpilation
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
"use strict"; | |
var gulp = require('gulp'), | |
babel = require('gulp-babel'), | |
watch = require('gulp-watch'), | |
plumber = require('gulp-plumber'), | |
path = { | |
src: { | |
js: 'src/*.js' | |
}, | |
dist: { | |
js: "dist/" | |
} | |
}; | |
gulp.task('6to5', function () { | |
gulp.src(path.src.js) | |
.pipe(plumber()) | |
.pipe(babel()) | |
.pipe(plumber.stop()) | |
.pipe(gulp.dest(path.dist.js)); | |
}); | |
gulp.task('watch', ['6to5'], function (){ | |
gulp.watch([path.src.js], [babel]); | |
}); | |
gulp.task('default', ['watch']); |
npm install --save-dev gulp gulp-watch gulp-babel gulp-plumber
watch = require('gulp-watch'),
Actually, gulp-watch is not used. To use it you need
.src(files).pipe(watch(files))
... instead of gulp.watch
It's 100 times faster than built-in gulp.watch
on OS X, but you also need npm install fsevents
. With that passive CPU usage goes from 10-50% to 0%.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install with: