Bootstrap Sass with Rails 4

前端 未结 2 1995
一个人的身影
一个人的身影 2021-01-07 08:51

I\'m trying to use bootstrap-sass (3.1.0.2) and sass-rails (4.0.1) in my rails (4.0.0) project.

My application.css.scss file looks like this:

/*
 * T         


        
相关标签:
2条回答
  • 2021-01-07 09:06

    Here's my setup with https://github.com/twbs/bootstrap-sass:

    # Gemfile
    gem 'bootstrap-sass'
    
    # application.css.scss
    /*
     *= require_self
     *= require vendor
     * require_tree .
     */
    
    @import "bootstrap";
    
    // Import individual stylesheet
    @import "base"; /* app/assets/stylesheets/base.css.scss */
    @import "events"; /* app/assets/stylesheets/events.css.scss */
    

    require_tree . is disabled, but importing individual CSS files (base, events) instead.

    0 讨论(0)
  • 2021-01-07 09:07

    I faced nearly the same problem few days ago. My configuration was quite the same but only few styling effects of Bootstrap were not working (especially the bg-whatever-color). After few gems updated the problem disappear.

    Some of my gems that I updated

    gem 'rails', '4.0.3'
    gem "bootstrap-sass", "~> 3.1.1.0"
    gem 'font-awesome-sass'
    gem 'sass-rails', '~> 4.0.0'
    

    Don't forget the:

    bundle update
    

    Part of my application.scss to give you an idea

    *= require jquery.ui.all
    *= require select2
    *= require font-awesome
    */
    
    @import "mixin_and_var";
    // changing the breakpoint value before importing bootstrap style
    // This change is made for the menu (navbar) to collapse on tablet for better view
    $screen-sm:1024px;
    @import "bootstrap";
    
    @import "general_layout";
    @import "header";
    @import "footer";
    @import "menus";
    @import "pagination";
    @import 'login';
    @import "error";
    

    Hope it helps!

    0 讨论(0)
提交回复
热议问题