문제

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?

도움이 되었습니까?

해결책

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 %>/'
  }
},

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top