1

我在我的 Gemfile 中有gem 'bootstrap-sass',在app/assets/stylesheets/custom.css.scss我的顶部有@import "bootstrap";

但这包括引导 css 膨胀 css 文件下载大小的所有 css。有没有办法只包含我正在使用的引导程序的 css 组件?

4

2 回答 2

1

当您导入“bootstrap”样式时,您实际上是从 gem 导入此文件: bootstrap.scss

如您所见,它只是导入其他文件,因此您可以将:替换 @import "bootstrap"; 为:

// Core variables and mixins
@import "bootstrap/variables"; // Modify this for custom colors, font-sizes, etc
@import "bootstrap/mixins";
// …
// Components: common
@import "bootstrap/sprites";
@import "bootstrap/dropdowns";
于 2012-10-27T08:30:49.477 回答
-1

Try using minified CSS code. Also when you import your bootstrap file it will import all of it, why do you want just the CSS components when you are have the custom CSS file to work with!

于 2012-10-27T08:17:04.983 回答