本文介绍了约曼角度生成器-生成的index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我正在将项目中的 Angular 库从 1.0.7 更新到 1.2.6 ,为此,我更新了 yeoman 生成器并再次生成了应用程序。

Last day I was in process of updating Angular library in my project from 1.0.7 to 1.2.6, to do this, I updated my yeoman generator and generated application again.

此后,我开始浏览生成的文件以了解更改,并注意到 index.html 文件中的新内容。

After this, I started browsing generated files to get hang of the changes and I noticed something new in index.html file.

    <!-- build:js scripts/vendor.js -->
    <!-- bower:js -->
    <script src="bower_components/jquery/jquery.js"></script>
    <script src="bower_components/angular/angular.js"></script>
    <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
    <script src="bower_components/angular-resource/angular-resource.js"></script>
    <script src="bower_components/angular-cookies/angular-cookies.js"></script>
    <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
    <script src="bower_components/angular-route/angular-route.js"></script>
    <!-- endbower -->
    <!-- endbuild -->

我知道<!-build:js脚本/供应商。 js-> <!-endbuild-> 注释由 grunt-usemin 任务,但是<!-bower:js-> <!-的目的是什么? -endbower-> ?在主页上发布的 bower 文档中找不到任何提及。

I know that <!-- build:js scripts/vendor.js --> and <!-- endbuild --> comments are used by grunt-usemin task, but what is the purpose of <!-- bower:js --> and <!-- endbower -->? I can't find any mention of it in bower documentation posted on main page.

推荐答案

这是,它是中。

最初,在对应用程序进行脚手架安装时,它会自动将Bower软件包连接到 index.html 文件。展望未来,安装或卸载Bower软件包后,您可以运行 grunt bower-install 来更新<!-中的引用。 -bower:*-> ...<!-endbower-> 块。

Initially, when you scaffolded the application, it automatically wired up your Bower packages to your index.html file. Going forward, after installing or un-installing a Bower package, you can run grunt bower-install to update the references inside of your <!-- bower:* -->...<!-- endbower --> blocks.

另外,请注意< head> 部分,有一个<!-bower:css-> 块,将引用您的Bower软件包的CSS文件。

Also, notice in the <head> section, there is a <!-- bower:css --> block, which will reference your Bower packages' CSS files.

更新-2014年8月7日

如果 grunt-bower-install 不起作用,请尝试(按顺序):
grunt cableep grunt bower-install grunt bowerInstall

If grunt-bower-install doesn't work try(in order):grunt wiredep, grunt bower-install, grunt bowerInstall

确保将bower install --save作为依赖项添加到bower.json中。

Make sure to bower install --save to add it to bower.json as a dependency.

这篇关于约曼角度生成器-生成的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:14