Last active
August 29, 2015 14:06
-
-
Save eiriklv/7d913c6dc6022c0533e0 to your computer and use it in GitHub Desktop.
Conditional sourcemaps for browserify
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 browserify = require('browserify'); | |
var gulp = require('gulp'); | |
var handleErrors = require('../util/handle-errors'); | |
var source = require('vinyl-source-stream'); | |
function createSingleBundle(options) { | |
browserify({ | |
entries: options.input, | |
extensions: options.extensions | |
}) | |
.bundle({ | |
debug: process.env !== 'production' | |
}) | |
.on('error', handleErrors) | |
.pipe(source(options.output)) | |
.pipe(gulp.dest(options.destination)); | |
} | |
function createBundles(bundles) { | |
bundles.forEach(function(bundle) { | |
createSingleBundle({ | |
input: bundle.input, | |
output: bundle.output, | |
extensions: bundle.extensions, | |
destination: bundle.destination | |
}); | |
}); | |
} | |
gulp.task('browserify', function() { | |
createBundles([{ | |
input: ['./client/javascript/app.js'], | |
output: 'app.js', | |
destination: './client/public/javascript/' | |
}]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment