Last active
August 31, 2016 21:10
-
-
Save juanmirod/3583133422616db50b1c6487e9b46b8c to your computer and use it in GitHub Desktop.
Working gulp task that transpiles and bundles the application using Babel 6.0, ES2015 preset and Browserify
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
var gulp = require('gulp'); | |
var babel = require('babelify'); | |
var browserify = require('browserify'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
/* | |
Transpiles the code using babel and es2015 preset and then bundles | |
the application in a file. | |
*/ | |
gulp.task('bundle', function() { | |
var bundler = browserify('./app/main.js', { debug: true }) | |
.transform(babel.configure({ | |
presets: ["es2015"] | |
})); | |
bundler.bundle() | |
.on('error', function(err) { console.error(err); this.emit('end'); }) | |
.pipe(source('build.js')) | |
.pipe(buffer()) | |
.pipe(gulp.dest('./dist/js')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment