Skip to content

Instantly share code, notes, and snippets.

@amazingandyyy
Last active October 5, 2016 02:02
Show Gist options
  • Save amazingandyyy/c8e32b9f90c969e9e19edc0eb6e8a0c4 to your computer and use it in GitHub Desktop.
Save amazingandyyy/c8e32b9f90c969e9e19edc0eb6e8a0c4 to your computer and use it in GitHub Desktop.
gulp for es6 -> all-browser-friendly
// change es6 to all-browser-friendly js
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber');
var babel = require('gulp-babel');
gulp.task('js', ['clean:js'], function() {
return gulp.src('dev/**/*.js') // input files
.pipe(sourcemaps.init()) // help to show where error is init
.pipe(plumber()) // fix gulp pipe
.pipe(babel({
presets: ['es2015'] // change to es5
}))
.pipe(concat('bundle.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('.')); // output files
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment