Created
April 5, 2017 13:25
-
-
Save travm/c2b60a4e226215ddfb37de44401675a4 to your computer and use it in GitHub Desktop.
Gulp, Browserify, & Babel Example
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
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var babelify = require('babelify'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
gulp.task('js', function () { | |
return browserify('src/main.js') | |
.transform('babelify', {presets: ['env']}) | |
.bundle() | |
.pipe(source('app.js')) // Readable Stream -> Stream Of Vinyl Files | |
.pipe(buffer()) // Vinyl Files -> Buffered Vinyl Files | |
// Gulp Plugins Here | |
.pipe(gulp.dest('dist')); | |
}); | |
gulp.task('watch', function () { | |
gulp.watch('src/**/*.js', gulp.series('js')); | |
}); | |
gulp.task('default', gulp.series('js', 'watch')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment