[英]How do I minify Bower components with Yeoman?
When I execute: 当我执行时:
yeoman init angular
yeoman install https://github.com/angular/bower-angular.git
yeoman build
Then 然后
ls dist/components/bower-angular/
returns 回报
angular.js component.json
While I expected angular.js to be minified and renamed to d10639ae.angular.js or something similar. 虽然我希望将angular.js缩小并重命名为d10639ae.angular.js或类似名称。
Any idea's? 有任何想法吗?
Minification in Yeoman is taken care of by the usemin-handler
: 约曼(Yeoman)中的缩小由usemin-handler
:
GruntFile.js GruntFile.js
// usemin handler should point to the file containing
// the usemin blocks to be parsed
'usemin-handler': {
html: 'index.html'
},
So open your index.html
: 因此,打开您的index.html
:
It should contain code like: 它应包含如下代码:
<script src="scripts/vendor/angular.js"></script>
<!-- build:js scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<!-- endbuild -->
Everything between build:js
and endbuild
will be minified. build:js
和endbuild
之间的所有endbuild
都会endbuild
。 So if you want to minify other libraries, place them between these two comment lines. 因此,如果要缩小其他库的大小,请将它们放在这两个注释行之间。
Note: there is an angular seed for Yeoman: 注意: Yeoman有一个有角的种子:
yeoman init angular
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.