Last active
August 29, 2015 14:25
-
-
Save aeldar/4df2b3a0f70f9bd58f94 to your computer and use it in GitHub Desktop.
Gulp, browserify, babelify, source maps, babel, es6
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
'use strict'; | |
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); | |
var source = require('vinyl-source-stream'); | |
var babelify = require('babelify'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var dependencies = [ | |
'jquery' | |
]; | |
gulp.task('browserify-vendor', function(){ | |
return browserify() | |
.require(dependencies) | |
.bundle() | |
.pipe(source('vendor.js')) | |
.pipe($.streamify($.uglify({ mangle: false }))) | |
.pipe(gulp.dest('public/js')); | |
}); | |
gulp.task('browserify', function(){ | |
return browserify(['public/scripts/app.js', 'public/scripts/app2.js'], {debug: true}) // debug: true добавляет инлайн source maps | |
.external(dependencies) | |
.transform(babelify) | |
.bundle() | |
.pipe(source('index.js')) | |
.pipe(gulp.dest('public/js')); | |
}); | |
gulp.task('default', ['browserify-vendor', 'browserify']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment