Skip to content

Instantly share code, notes, and snippets.

Created February 22, 2016 13:38
What would you like to do?
Configure grunt-bower-task with Sails.js (Bootstrap + jQuery as example)
* Task to pull out specific files from bower packages.
module.exports = function (grunt) {
grunt.config.set('bower', {
install: {
options: {
layout: function(type, component) {
return type;
targetDir: './assets',
install: true,
cleanTargetDir: false,
cleanBowerDir: false
"name": "sails-bower",
"dependencies": {
"jquery": "^2.2.0",
"bootstrap": "^3.3.6"
"exportsOverride": {
"bootstrap": {
"styles": "dist/css/*.min.css",
"fonts": "dist/fonts/*",
"js/dependencies": "dist/js/bootstrap.min.js"
"jquery": {
"js/dependencies": "dist/jquery.min.js"
module.exports = function (grunt) {
grunt.registerTask('default', ['bower:install', 'compileAssets', 'linkAssets', 'watch']);
// CSS files to inject in order
var cssFilesToInject = [
// Client-side javascript files to inject in order
var jsFilesToInject = [
// Load before everything else
// Dependencies like jQuery, or Angular are brought in here
// All of the rest of your client-side js files
// will be injected here in no particular order.
module.exports = function(grunt) {
grunt.registerTask('prod', [
Copy link

The files should go in the following places (GitHub gist doesn't allow path in filenames):

Don't forget to install grunt-bower-task as a dev dependency using:
npm install grunt-bower-task --save-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment