Skip to content

Commit

Permalink
fixes #18.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Aug 12, 2013
1 parent 97cda7d commit 71d9b14
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tasks/bower-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,30 @@ var findBowerJSON = function () {
};


/**
* Try to use a `.bowerrc` file to find a custom directory. If it doesn't exist,
* we're going with "bower_components".
*
* @ return {string} the path to the bower component directory
*/
var findBowerDirectory = function () {
var directory = 'bower_components';

if (grunt.file.isFile('.bowerrc')) {
directory = grunt.file.readJSON('.bowerrc').directory || 'bower_components';
}

return directory;
};


module.exports = function (grunt) {
grunt.registerMultiTask('bower-install', 'Inject all components in your HTML file.', function () {

this.requiresConfig(['bower-install', this.target, 'html']);

wiredep({
directory: grunt.file.readJSON('.bowerrc').directory || 'bower_components',
directory: findBowerDirectory(),
bowerJson: findBowerJSON(),
ignorePath: this.data.ignorePath,
htmlFile: this.data.html
Expand Down

0 comments on commit 71d9b14

Please sign in to comment.