我使用的是yeoman的主干生成器,我运行了以下代码:
bower install backbone.localStorage -S我不得不手动将以下代码插入到index.html中:
<script src="bower_components/backbone.localStorage/backbone.localStorage.js"></script>有没有办法让bower自动插入<script>标签?我认为bower的部分好处是不必弄清楚按哪种顺序包含脚本?
发布于 2013-09-16 05:44:39
Bower不会添加对这样的特定功能的支持,但很快就会允许您指定在“bower安装”新包之后要采取的操作。这将被称为"postinstall“,类似于npm。
不过,与此同时,我已经创建了一个库来帮助实现这一点。由于您使用的是yeoman,因此只需添加"grunt-bower-install“作为npm 'devDependency',然后按照此处的说明进行操作:https://github.com/stephenplusplus/grunt-bower-install。
https://stackoverflow.com/questions/18814806
复制相似问题