Specifying latest revision of a particular branch with bower

纵然是瞬间 提交于 2019-11-29 20:23:18
user1429980

You need to use the #, appended to the component name:

bower install bootstrap#version3-branch-name

And as you might expect, if you add --save-dev to that, then it will add to your bower.json file:

"bootstrap": "version3-branch-name"

You can specify the commit SHA instead of a version:

bower install bootstrap#37d0a30589

Note that specifying a branch in production or reusable modules is bad practice as it's a moving target and will eventually break something. Discussion about it here.

Chad

Until bower gets the ability to target a specific commit as @Sindre noted, I am taking advantage of bower's ability to target arbitrary zip files. I specified github's zip of bootstrap's 3.0 branch in my component.json:

"bootstrap": "https://github.com/twbs/bootstrap/archive/3.0.0-wip.zip"

I understand this is bad practice to target a branch (rather than a specific commit), but this works for me for now as a stopgap.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!