24

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?

Brian
  • 1,028
  • 12
  • 20

5 Answers5

17

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

tungd
  • 14,467
  • 5
  • 41
  • 45
  • https://github.com/jozefizso/bower-bootstrap-css also contains built files, and goes all the way back to 2.3.0, in case anyone needs that, in the age of bower being deprecated! – ptim Jul 12 '17 at 04:58
14

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 %>/'
  }
},
xiaoboa
  • 1,953
  • 14
  • 18
3

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

Community
  • 1
  • 1
bkaid
  • 51,465
  • 22
  • 112
  • 128
3

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:  /\.\.\//
  },
Nolan Lawrence
  • 312
  • 2
  • 10
3

You can execute:

bower install bootstrap-css-only
Mariusz Jamro
  • 30,615
  • 24
  • 120
  • 162
fallwind
  • 159
  • 1
  • 4