【发布时间】:2014-10-24 14:41:44
【问题描述】:
tooltip.js 默认情况下不包含在 Bootstrap 中,但我想将其添加到使用 Bower 的 Yoeman 脚手架应用程序中。我尝试将其添加到 bower.json 数组中的 main :
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js",
"js/tooltip.js",
"dist/fonts/glyphicons-halflings-regular.eot",
"dist/fonts/glyphicons-halflings-regular.svg",
"dist/fonts/glyphicons-halflings-regular.ttf",
"dist/fonts/glyphicons-halflings-regular.woff"
],
但这不会自动包含在<!-- bower:js --> 内index.html 内的脚本列表中。如何更新此依赖项列表并让 bower 重建此列表?有没有办法在不手动将要求添加到bower.json 的情况下做到这一点?
【问题讨论】:
-
您是否在编辑完 bower.json 后重新运行 bower install?
-
凉亭安装什么?我最初没有通过 bower 安装引导程序,因为它是 yeoman 中角种子的一部分
-
向 bower.json 添加内容不会将其包含在项目中,它只是文件中的一行。如果您已编辑 bower.json 以包含新内容,请在命令行中导航到包含 bower.json 的目录并运行“bower install”。这将检测要添加的新组件,下载并添加文件并包含在您的 index.html 中
-
这不会更新任何内容。需要明确的是,我已将
"js/tooltip.js"添加到bower_components/bootstrap内的bower.json中,然后从与bower.json文件相同的文件夹中运行bower install(和bower install --save)。没发生什么事!感谢您的帮助。 -
我不建议编辑嵌套在 bootstrap 文件夹中的 bower.json。这是引导项目的依赖项列表。您希望在项目中添加一些内容,因此您应该将其添加到项目根目录中 bower.json 的依赖项中,然后运行 bower install
标签: angularjs twitter-bootstrap yeoman bower