Search code examples
rubytwitter-bootstrapsasscompass

Compass CSS framework - using Bootstrap with SASS


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:

enter image description here

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.


Solution

  • (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
    ...