【发布时间】:2017-12-06 13:09:13
【问题描述】:
我刚刚开始了解 usemin 和 wiredep。我的 index.html 文件中有这个:
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<!-- endbower -->
<!-- build:css(.tmp) styles/core.css -->
<link rel="stylesheet" href="styles/core.css">
<!-- endbuild -->
如果我运行 grunt build,index.html 会被修改为:
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/angular-loading-bar/build/loading-bar.css" />
<link rel="stylesheet" href="bower_components/angular-ui-select/dist/select.css" />
<link rel="stylesheet" href="bower_components/ng-notify/src/styles/ng-notify.css" />
<link rel="stylesheet" href="bower_components/components-font-awesome/css/font-awesome.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/core.css -->
<link rel="stylesheet" href="styles/core.css">
<!-- endbuild -->
这很好,但它只发生在 bower:css 文件中(我相信这是用 wiredep 完成的。在我的页面下方,我有类似于 JavaScript 文件这也有效。 我想为我自己的 JavaScript 文件做这件事。目前我有大约 100 个,我已经手动将它们放入我的 src/index.html 中。构建我的应用程序时,usemin 将我的脚本替换为连接后的丑陋版本,这非常棒。但是当我构建时,我希望 src/index.html 从 src/app 目录中获取所有脚本并将它们注入到我的 html 文件中。
这个可以吗?
【问题讨论】:
标签: javascript grunt-usemin wiredep grunt-wiredep