簡體   English   中英

如何使用Yeoman縮小Bower組件?

[英]How do I minify Bower components with Yeoman?

當我執行時:

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

然后

ls dist/components/bower-angular/

回報

angular.js  component.json

雖然我希望將angular.js縮小並重命名為d10639ae.angular.js或類似名稱。

有任何想法嗎?

約曼(Yeoman)中的縮小由usemin-handler

GruntFile.js

 // usemin handler should point to the file containing
    // the usemin blocks to be parsed
    'usemin-handler': {
      html: 'index.html'
    },

因此,打開您的index.html

它應包含如下代碼:

    <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 -->

build:jsendbuild之間的所有endbuild都會endbuild 因此,如果要縮小其他庫的大小,請將它們放在這兩個注釋行之間。

注意: Yeoman有一個有角的種子:

yeoman init angular

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM