Reputation: 6108
I have setup SASS and Grunt. Every time I save my main.scss
file, it will compile it to CSS. Perfect.
Now, in the top of main.scss
I import bootstrap:
@import "bootstrap";
However, when I do this, each SCSS -> CSS compile takes around 8 seconds!
Is there a smarter way to import bootstrap? I specially import it, because I need to make use of extend
, i.e.:
.button {
@extend .btn;
}
Upvotes: 1
Views: 428
Reputation: 14440
You have 2 solutions and a bonus :
don't compile bootstrap. Quick but you lose the @extend ".bootstrap-class". But do you really need to compile bootstrap just for that? Isn't adding the existing bootstrap classes to your html a better option ?
compile bootstrap with just the minimum you need. Replace :
@import "bootstrap";
by a file containing the content of bootstrap.scss (in the bootstrap github repo that you npm-installed) where you comment/uncomment only what you really need :
// Core variables and mixins
//@import "../vendor/bootstrap-sass-official/assets/stylesheets/bootstrap/variables";
@import "../vendor/bootstrap-sass-official/assets/stylesheets/bootstrap/mixins";
// Reset
//@import "../vendor/bootstrap-sass-official/assets/stylesheets/bootstrap/normalize";
//@import "../vendor/bootstrap-sass-official/assets/stylesheets/bootstrap/print";
[...]
Upvotes: 1