Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt-bower-install: exclude certain components

I just created a new webapp using the angular-fullstack yeoman generator.

I noticed that grunt-bower-install is generating the JS bower components in my index.html files between the <!-- bower:js --> tags.

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

How do I exclude certain bootstrap components?

like image 519
mushroom Avatar asked May 16 '14 17:05

mushroom


1 Answers

The plugin grunt-bower-install (aka grunt-wiredep) supports an 'exclude' parameter to list the components that you do now want to be automatically injected.

For example, if you didn't want dropdown included just list that component with full pathname:

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

And then run again grunt bower-install.

For further options see the underline library wiredep: https://github.com/taptapship/wiredep

like image 52
MrTorture Avatar answered Sep 21 '22 01:09

MrTorture