Last active
October 5, 2016 02:02
-
-
Save amazingandyyy/c8e32b9f90c969e9e19edc0eb6e8a0c4 to your computer and use it in GitHub Desktop.
gulp for es6 -> all-browser-friendly
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
// 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