Grunt的wiredep任務的配置說明文檔,gruntwiredep

來源:互聯網
上載者:User

Grunt的wiredep任務的配置說明文檔,gruntwiredep
Automatically inject Bower components into the HTML file自動把Bower的組件注入到HTML檔案中
如果我們通過以下方式安裝組件

bower install jquery --savebower install sea.js --save



安裝後會在bower.json檔案中看到
{  "name": "framework-demo",  "private": true,  "dependencies": {    "jquery": "~2.1.4",    "jquery-ui": "~1.11.4",    "knockout": "^3.3.0",    "seajs": "^3.0.0"  }}



在Gruntfile.js檔案中配置wirdep Task
  wiredep: {      app: {        src: ['<%= config.app %>/index.html'],        ignorePath: /^(\.\.\/)*\.\./      }    }

執行grunt wiredep命令
在index.html檔案會把預設dependencies依賴中的組件自動注入到下面標籤中去。
 <!-- bower:js -->    <script src="/bower_components/jquery/dist/jquery.js"></script>    <script src="/bower_components/jquery-ui/jquery-ui.js"></script>    <script src="/bower_components/knockout/dist/knockout.js"></script>    <script src="/bower_components/seajs/dist/sea.js"></script> <!-- endbower --> 

wiredep中的option中的參數devDependencies:注入開發版中的相依元件;dependencies:注入相依元件;directory: 'the directory of your Bower packages.' 存放bower包的目錄,這個目錄是'.bowerrc'檔案中的.directory

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.