Compass CSS framework - using Bootstrap with SASS

大城市里の小女人 提交于 2019-12-04 06:02:19

问题


I want to use Bootstrap with SASS, but I can't find any tutorials or explanation how one can use Bootstrap with SASS. The only thing I find is installatio trough a ruby gem:

compass create my-new-project -r bootstrap-sass --using bootstrap

Which creates the following tree in my folder:

Is this enough for Bootstrap to use its own Grid, because I don't see the bootstrap.scss file, neither any Grid related files. However, I find the grid classes and all in a styles.css file. Isn't there a bootstrap.scss file that has all the mixins and everything else? And where can I find a more extended use of SASS's Bootstrap mixins, which are described here briefly:

http://www.hongkiat.com/blog/bootstrap-and-sass/

Thank You all in advance! I really can't find nothing on my problem.


回答1:


(I'm using .sass files in my answer, but it should apply to .scss files, too)

Isn't there a bootstrap.scss file that has all the mixins and everything else?

Yes, there is. Here's the generated styles.sass file:

// Import Bootstrap Compass integration
@import "bootstrap-compass"
// Import custom Bootstrap variables
@import "bootstrap-variables"
// Import Bootstrap for Sass
@import "bootstrap"

bootstap_variables refers to the generated _bootstrap-variables.sass file in your project tree, whereas bootstrap-compass and bootstrap are imported from the gem's stylesheets directory.

The latter imports all other Bootstrap files, including the grid:

// Core variables and mixins
@import "bootstrap/variables";
@import "bootstrap/mixins";

// Reset and dependencies
@import "bootstrap/normalize";
@import "bootstrap/print";
@import "bootstrap/glyphicons";

// Core CSS
@import "bootstrap/scaffolding";
@import "bootstrap/type";
@import "bootstrap/code";
@import "bootstrap/grid";        # <-- here it is
...


来源:https://stackoverflow.com/questions/28317357/compass-css-framework-using-bootstrap-with-sass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!