grunt-bower-install:排除某些组件

我刚刚使用angular-fullstack yeoman生成器创build了一个新的webapp。

我注意到,grunt-bower-install在<!-- bower:js -->标记之间的index.html文件中生成了JS bower组件。

 <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/affix.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/alert.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/button.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/carousel.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/collapse.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/dropdown.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/tab.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/transition.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/scrollspy.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/modal.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/tooltip.js"></script> <script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/popover.js"></script> <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="bower_components/angular-cookies/angular-cookies.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> <script src="bower_components/angular-route/angular-route.js"></script> <!-- endbower --> 

我如何排除某些引导组件?

       

网上收集的解决方案 "grunt-bower-install:排除某些组件"

插件grunt-bower-install(aka grunt-wiredep)支持一个'exclude'参数来列出你现在想要自动注入的组件。

例如,如果您不希望包含下拉列表,那么只需列出具有完整path名的组件:

 'bower-install': { app: { html: '<%= yeoman.app %>/views/index.html', ignorePath: '<%= yeoman.app %>/', exclude: ['bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/dropdown.js'] } }, 

然后再运行grunt bower-install。

有关更多选项,请参阅下划线库wiredep: https : //github.com/taptapship/wiredep