Grunt中如何引用bower安装的库

NodeJS juo 发表于 6 年前最后回复来自 qq2850071112 4 年前

我在bower.json中添加了dependencies,然后执行 bower install安装该依赖,那我在我的页面中该如何引用呢?这个有什么规律吗?

我用YEOMAN生成的Ember项目中看到了下面的例子:

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/handlebars/handlebars.runtime.js"></script>
<script src="@@ember "></script>
<script src="@@ember_data "></script>
<!--这个是我加的-->
<script src="@@ember -animated-outlet"></script>

生成如下HTML代码

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/handlebars/handlebars.runtime.js"></script>
<script src="bower_components/ember/ember.js"></script>
<script src="bower_components/ember-data/ember-data.js"></script>
<script src="bower_components/ember/ember.js_aniated_outlet"></script>
共收到2条回复
kshift 5 年前 #1

.bowerrc 里面写依赖安装的路径,然后在 grunt 里面直接写路径不行么?

nanana 5 年前 #2

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/handlebars/handlebars.runtime.js"></script>
<script src="bower_components/ember/ember.js"></script>
<script src="bower_components/ember-data/ember-data.js"></script>
<script src="bower_components/ember/ember.js_aniated_outlet"></script>

这些是自动生成的?

登录后即可参与回复