Using Bower without minified files

Posted September 11, 2014 « More articles

I maintain an open source project, noUiSlider. One of the recurring issues has been the absence of minified/compiled files in the repository, even though Bowers guidelines claim this should not be required.

Committing all files is a pain, as it obfuscates actual changes and hides them behind a ton of other files that didn't really change. I went on a search for a solution.

This issue has been bugging other maintainers as well, and I soon stumbled upon a Github issue discussing the release-workflow of the 'Chosen' project.

To summarize, it suggests adding a release path to bower.json, instead of the actual dependency:

	  "name": "my-project",
	  "version": "1.0.0",
	  "dependencies": {
		"jquery": "1.10.2",
		"chosen": ""

Substituting the 'chosen' files by the latest noUiSlider release is simple enough:

"noUiSlider": ""

Installing bower and the manifest:

npm install -g bower
bower install

It got mad at me:

bower nouislider#* error Unsupported file type "undefined"

Turns out this is a known problem in grunt-contrib-compress, and easily resolved by updating the package with NPM. I rebuild the noUiSlider release zip, and added it back into the release on GitHub.

npm cache clean
npm update

Bower didn't like me yet: Git wasn't in my path.

bower ENOGIT git is not installed or not in the PATH

I fixed that by adding the git.exe paths to my PATH manually. Probably not the most sustainable solution, but as I'm using Github for Windows a quick fix did the trick.

Once more:

bower install

Bower now extracted all compiled and minified files in bower_components\noUiSlider.

All in all, this has many advantages: