Question

Starting a new Angular project via Yeoman asks if you want to include Twitter Bootstrap (I'm using Sass flavor). Doing so includes both the styles and scripts. However, I want to use UI Bootstrap instead of Bootstrap's scripts (which depend on jQuery).

So, is it possible to install only Bootstrap's styles (preferably in Sass) with Bower? Or do I just need to download and include the Bootstrap styles manually?

Was it helpful?

Solution

just add exclude option in grunt bowerInstall task, and bowerInstall task will not inject the excluded file in the html file

bowerInstall: {
  app: {
    src: ['<%= yeoman.app %>/index.html'],
    exclude: ['bower_components/bootstrap/dist/js/bootstrap.js'],
    ignorePath: '<%= yeoman.app %>/'
  }
},

OTHER TIPS

I know one CSS-only Bootstrap packages in Bower: bootstrap-css-only; However it comes with precompiled CSS but not SASS.

Based on this answer, you could add this to .bowerrc to delete the Bootstrap JS files:

{ "directory": "bower_components", "scripts": { "postinstall": "rm -rf bower_components/bootstrap-sass-official/assets/javascripts" } }

if you don't have a bowerInstall task in your gruntfile as mentioned in the accepted answer, this also works in the wiredep task.

 wiredep: {
  app: {
    src: ['<%= yeoman.app %>/index.html'],
    exclude: ['bower_components/bootstrap/dist/js/bootstrap.js'],
    ignorePath:  /\.\.\//
  },

You can execute:

bower install bootstrap-css-only
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top