2013-04-02 56 views
62

我想指定特定分支的最新版本作为依赖项。具体来说,我想在发布之前使用Bootstrap v3.0。使用凉亭指定特定分支的最新版本

什么是指定作为凉亭的依赖最好的方法是什么?

+0

可能重复[如何使用bower安装repo的最新(未标记)状态?](http://stackoverflow.com/questions/16949173/how-to-install-latest-untagged-state-of-a-repo-using-凉亭) –

回答

87

您需要使用#appended to the component name

bower install bootstrap#version3-branch-name 

正如你所预料的,如果添加--save-dev到这一点,那么它会添加到您的bower.json文件:

"bootstrap": "version3-branch-name" 
+2

这项工作,应该是upvoted。另一个例子''ckeditor“:”#basic/latest“'for https://github.com/ckeditor/ckeditor-releases – Offirmo

+0

这是否会自动在重新运行bower install时从同一分支中提取新更改? –

43

您可以指定提交,而不是一个版本SHA:

bower install bootstrap#37d0a30589 

请注意,指定生产或可重用模块的一个分支是不好的做法,因为它是一个移动的目标,并最终会碰坏。讨论一下吧here

+0

这是什么状态? –

+4

https://github.com/bower/bower/pull/441 –

21

直到鲍尔得到target a specific commit的能力,正如@Sindre指出的那样,我利用鲍尔的能力来定位任意的zip文件。我指定的自举的3.0分支的GitHub的拉链在我component.json:

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

我理解,这是不好的做法,目标分支(而不是具体的承诺),但现在这个工作对我来说是一个权宜之计。

+1

我不确定这本身就是一个坏习惯,这取决于你如何使用它。 – shabunc

+1

Bower现在允许您针对特定提交 – YPCrumble