|
|
|
@ -4,7 +4,11 @@ var entryBundles = require('../files/browserify_entry_bundles');
|
|
|
|
|
var concatBundles = require('../files/browserify_concat_bundles');
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
task: function() {
|
|
|
|
|
task: function(browserifyWatch, browserifyDebug, assetsDir) {
|
|
|
|
|
if (browserifyWatch === undefined) throw new TypeError('browserifyWatch is required, expected a value of true|false');
|
|
|
|
|
if (browserifyDebug === undefined) throw new TypeError('browserifyDebug is required, expected a value of true|false');
|
|
|
|
|
if (typeof assetsDir !== 'string' || assetsDir.length === 0) throw new TypeError('assetsdir is required, expected a non-empty string');
|
|
|
|
|
|
|
|
|
|
var cfg = {
|
|
|
|
|
options: {
|
|
|
|
|
preBundleCB: function(b) {
|
|
|
|
@ -31,11 +35,12 @@ module.exports = {
|
|
|
|
|
transform: [],
|
|
|
|
|
|
|
|
|
|
// enables watchify when grunt is run with a watch task, e.g. `grunt browserify watch:js`
|
|
|
|
|
watch: '<%= env.browserify_watch %>',
|
|
|
|
|
watch: browserifyWatch,
|
|
|
|
|
|
|
|
|
|
browserifyOptions: {
|
|
|
|
|
browserifyOptions: {
|
|
|
|
|
// if true will include source maps
|
|
|
|
|
debug: '<%= env.browserify_debug %>' }
|
|
|
|
|
debug: browserifyDebug
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (bundle.options) {
|
|
|
|
@ -47,7 +52,7 @@ module.exports = {
|
|
|
|
|
cfg[name] = {
|
|
|
|
|
options: options,
|
|
|
|
|
src: bundle.src,
|
|
|
|
|
dest: bundle.dest || '<%= assets_dir %>/javascripts/' + name +'.js'
|
|
|
|
|
dest: bundle.dest || assetsDir +'/javascripts/' + name +'.js'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|