grunt-browserify
grunt-browserify copied to clipboard
Using the require option
I'm wondering if someone can post an example of using this options. While in browserify, this runs fine:
browserify -r ./public/js/productionJS/recommendationConcatFooter.js:selector > ./public/js/productionJS/recommendationFooter.js
but in my gruntfile,
footer: {
src: ['public/js/productionJS/recommendationConcatFooter.js'],
dest: 'public/js/productionJS/recommendationFooter.js',
options: {
debug: true,
require: ['./public/js/productionJS/recommendationConcatFooter.js:selector']
}
}
doesn't return any errors when I run grunt, but when I go to include the module selector in a script tag, I get a 'can't find module selector' error.
Remove the file from your src
.
Just keep src: []
To generate a separate bundle for project libraries, I do this:
plugins: {
options: {
debug: true,
require: [
'jquery',
'underscore',
'backbone',
'backbone.marionette'
]
},
files: {
'<%= paths.dist.base %>/plugins.js': []
}
}
Apparently, it works fine.