using bower in grunt
After looking at several grunt tasks out there trying to accomplish package installation using bower through grunt, I realized that it was actually easier to take advantage of Bower's API wrapped in a tiny custom grunt task:
grunt.registerTask('bower', 'Install js packages listed in bower.json',
function() {
var bower = require('bower');
var done = this.async();
bower.commands.install()
.on('data', function(data){
grunt.log.write(data);
})
.on('error', function(data){
grunt.log.write(data);
done(false);
})
.on('end', function (data) {
done();
});
}
);
This uses standard .bowerrc for Bower specific settings and bower.json for the list of the dependencies to install
Written by Philip Nuzhnyi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Grunt
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#