Configure bower to install only dist folder Configure bower to install only dist folder git git

Configure bower to install only dist folder


What you're looking for is the ignore property in bower.json: https://github.com/bower/bower.json-spec

The developer of the module can use the ignore attribute to exclude files when the module is downloaded and installed through Bower.

If you are the developer of said module, you can use the ignore attribute to exclude everything but the dist folder.

If you're not the developer of the module, then there's not much you can do, you will get whatever the developer of the module has deemed significant. In most cases, this is not a problem.

Here's a typical configuration for the ignore attribute:

{  "ignore": [    "**/.*",    "node_modules",    "bower_components",    "test",    "package.json",    "src"  ]}


Bower does not provide any option to do that. Mostly because they have refused to.

All we are left to is hacky ways to deal with it, like grunt-wiredep, which doesn't solve the problem in a strict sense.

Good luck!


From Bower's api documentation, there doesn't seem to be anything to say "Install just the dist folder".

As you are using Grunt already, you could probably create a task to run after your bower install using grunt-contrib-clean to remove unwanted files and folders from the bower_components folder.

Something like this should remove everything from the bower_components folder except dist folders:

clean : {    dist : ['bower_components/*/*', '!bower_components/*/dist']}

While looking into this I also found grunt-bower-task which seems to do exactly that. The only drawback I see to this method is that you have to create the bower.json by hand first and then run the grunt task.