Coder Social home page Coder Social logo

Comments (4)

mcbsys avatar mcbsys commented on April 28, 2024

Sorry, just realized that even more explicit instructions are needed. If the file containing the @import statement is loaded based on the default //= require_tree . in application.css, then the file must be named so that it precedes all other files alphabetically. If it's named bootstrap_loader.css.scss and I have an apples.css.scss file containing custom CSS, the CSS in apples.css.scss will be clobbered by bootstrap.

There may be a way around this by using subdirectories and/or the 'stub' directive added to Sprockets 2.2.0. For now, naming the file "!bootstrap_loadfirst.css.scss" is a workaround. Other suggestions?

from bootstrap-sass.

thomas-mcdonald avatar thomas-mcdonald commented on April 28, 2024

Sorry, just realized that even more explicit instructions are needed. If the file containing the @import statement is loaded based on the default //= require_tree . in application.css, then the file must be named so that it precedes all other files alphabetically. If it's named bootstrap_loader.css.scss and I have an apples.css.scss file containing custom CSS, the CSS in apples.css.scss will be clobbered by bootstrap.

I think that, in general, if you're using Sass w/Rails, it's better to have a application.css.scss file that uses @import to require exactly the files you want to load, or to explicitly define the files you want to load (using //require x), and in which order.

Having said that, the Readme isn't exactly clear wrt. require specifications. I'll see what I can cook up for 2.0.2.

from bootstrap-sass.

mcbsys avatar mcbsys commented on April 28, 2024

FWIW, here is what I'm using now. I created application and scopes directories under app/assets/stylesheets for my application-level and scope-level override stylesheets, respectively. Then I have these "top-level" files:

app/assets/stylesheets/application.css:

/*
 * Load Bootstrap first so we can override it
 *= require bootstrap_loader

 * Application-level styles next
 *= require_directory ./application

 * Anything in this file is also application-level
 *= require_self

 * Finally the scope-level styles
 *= require_directory ./scopes

 * Note that we do NOT have the default "require_tree /." because we want to 
 * control the sequence of loads, especially getting Bootstrap loaded first.
*/

app/assets/stylesheets/bootstrap_loader.css.scss:

/* Do NOT name this file "bootstrap.css.scss" or you will get an @import loop. */

/* Override Bootstrap variables here */
// $primaryButtonBackground: #f00;

@import "bootstrap";
@import "bootstrap-responsive";

Seems to be working.

from bootstrap-sass.

thomas-mcdonald avatar thomas-mcdonald commented on April 28, 2024

Fixed in 2.0.2

from bootstrap-sass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.