Automatic concatenation of installed Bower components in right order.
This plugin requires Grunt 0.4.
$ npm install grunt-bower-concat --save-dev
Add somewhere in your Gruntfile.js
:
grunt.loadNpmTasks('grunt-bower-concat');
Inside your Gruntfile.js
file add a section named bower_concat
. See Parameters section below for details.
Type: String
.
Name of file where result of concatenation will be saved.
Type: String|Array
, optional.
List of components you want to exclude.
exclude: [
'jquery',
'modernizr'
]
Type: String|Array
, optional.
By default bower-concat will include all installed in project components. Using include
option you can manually specify which components should be included.
include: [
'underscore',
'backbone'
]
Type: Object
, optional.
Unfortunately not all Bower components list their dependencies. If comoponents concatenates in wrong order use this option to manually specify dependencies for that components.
dependencies: {
'underscore': 'jquery',
'mygallery': ['jquery', 'fotorama']
}
Type: Object
, optional.
Some Bower components don’t list their main files or (more likely) don’t have bower.json
file at all. In this case bower-concat
will try to guess main file but sometimes it can’t or choose wrong one. You could explicitly define main files for that components.
mainFiles: {
'svg.js': 'dist/svg.js',
'mygallery': ['src/base.js', 'src/gallery.js']
}
Type: Object
, optional.
Bower specific options that will be passed in during the bower.commands calls.
bowerOptions: {
relative: false
}
bower_concat: {
all: {
dest: 'build/_bower.js',
exclude: [
'jquery',
'modernizr'
],
dependencies: {
'underscore': 'jquery',
'backbone': 'underscore',
'jquery-mousewheel': 'jquery'
},
bowerOptions: {
relative: false
}
}
}
The changelog can be found in the Changelog.md file.
The MIT License, see the included License.md
file.