Search code examples
cssruby-on-railsrubybootstrap-sass

creating custom scss file


I'm install bootstrap gem and follow all direction to change application.css, however when I create another custom .scss file, customizations from the custom file werent included in application.css.scss . I have tried to import boot strap and bootstrap-sprockets to the custom file as well, but no changes were made on the website. How can I make the customizations on the newly created custom.scss file to show on the website.

the application.css.scss file contains only 2 lines

@import "bootstrap-sprockets";
@import "bootstrap";

Solution

  • If I've read your question correctly, you have application.scss, which contains

    @import "bootstrap-sprockets";
    @import "bootstrap";
    

    and also your custom.scss file, contents of which you want to end up in application.css. You need to add it to your application.scss file, ie -

    @import "bootstrap-sprockets";
    @import "bootstrap";
    @import "custom";
    

    It's also recommended to begin the name of .scss files which you are importing (also known as partials) with an underscore, so in this case custom.scss becomes _custom.scss.

    And make sure you recompile the application.scss to application.css so the changes are actually made - I'm not sure what you're using to compile your sass but I think this may be the step you are missing.