Skip to content

Instantly share code, notes, and snippets.

@chrisl8888
Last active February 20, 2016 07:21
Show Gist options
  • Save chrisl8888/84c0574c023ce6920b36 to your computer and use it in GitHub Desktop.
Save chrisl8888/84c0574c023ce6920b36 to your computer and use it in GitHub Desktop.
Gulp file for Basic Babel (6to5) transpilation
"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']);
@chrisl8888
Copy link
Author

Install with:

npm install --save-dev gulp gulp-watch gulp-babel gulp-plumber

@Lendar
Copy link

Lendar commented Mar 11, 2015

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