How to add Bower component when it’s not in the repository?

Sometimes component that you want to use in your project isn’t available in Bower repo. There is a way to install it, even in very specified version. Go to project’s Github, in my case it’s here. Copy URL from the browser, and paste it somewhere. Now go to relases and click commit id that you’re interested in (this random blue colored string):

After that you’ll see full commit id, in this case it’s fef978b279c546923ad4f4118acea4d503e7596c. Paste that to the end of repository URL you’ve copied earlier. Remember to prefix it with # char and add .git to the URL:

https://github.com/bfintal/Counter-Up.git#fef978b279c546923ad4f4118acea4d503e7596c

Finally mix it with your bower.json file. Here’s full example:

{
	"name": "Realhero report",
	"description": "Report template based on New Age",
	"main": "index.js",
	"authors": ["Konrad Fedorczyk"],
	"license": "ISC",
	"homepage": "http://realhe.ro",
	"private": true,
	"ignore": ["**/.*", "node_modules", "bower_components", "test", "tests"],
	"dependencies": {
	    "bootstrap": "^3.3.7",
	    "font-awesome": "^4.6.3",
   	 	"jquery": "^1.11.3",
   	 	"simple-line-icons": "^2.3.2",
   	 	"morris.js": "^0.5.1",
   	 	"jqvmap-fedek6": "https://github.com/fedek6/jqvmap.git#774c12a57916ab82e17406203bb41522dfe0e38b",
   	 	"Counter-Up": "https://github.com/bfintal/Counter-Up.git#fef978b279c546923ad4f4118acea4d503e7596c"
	}
}

Look at the last line of dependencies part, here’s component that I’ve added.



Tags: