Skip to content

Instantly share code, notes, and snippets.

@aeldar
Last active August 29, 2015 14:25
Show Gist options
  • Save aeldar/4df2b3a0f70f9bd58f94 to your computer and use it in GitHub Desktop.
Save aeldar/4df2b3a0f70f9bd58f94 to your computer and use it in GitHub Desktop.
Gulp, browserify, babelify, source maps, babel, es6
'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