最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I minify Bower components with Yeoman? - Stack Overflow

programmeradmin2浏览0评论

When I execute:

yeoman init angular
yeoman install .git
yeoman build

Then

ls dist/ponents/bower-angular/

returns

angular.js  ponent.json

While I expected angular.js to be minified and renamed to d10639ae.angular.js or something similar.

Any idea's?

When I execute:

yeoman init angular
yeoman install https://github./angular/bower-angular.git
yeoman build

Then

ls dist/ponents/bower-angular/

returns

angular.js  ponent.json

While I expected angular.js to be minified and renamed to d10639ae.angular.js or something similar.

Any idea's?

Share Improve this question asked Jan 11, 2013 at 15:45 Pieter HerroelenPieter Herroelen 6,0662 gold badges32 silver badges37 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

Minification in Yeoman is taken care of by the usemin-handler:

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:

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. So if you want to minify other libraries, place them between these two ment lines.

Note: there is an angular seed for Yeoman:

yeoman init angular
发布评论

评论列表(0)

  1. 暂无评论