Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8657339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:29:51+00:00 2026-06-12T15:29:51+00:00

With bootstrap-sass you can overload variables by defining them before importing bootstrap (as in

  • 0

With bootstrap-sass you can overload variables by defining them before importing bootstrap (as in documentation):

$btnPrimaryBackground: #f00;
@import "bootstrap";

Sadly it doesn’t work with mixins since in SASS they can be redefined / overloaded.

What would be the best approach to overload a twitter bootstrap mixins ? So far the only way to do it seems to clone the gem in lib and add modify _mixins.scss or include my custom _mixins.scss after.

Any idea to make this more maintainable ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:29:52+00:00Added an answer on June 12, 2026 at 3:29 pm

    According to the post, Reopen SASS Mixins, it is possible to override mixins. However, if you define your custom one prior to calling import "bootstrap"; the one defined inside Bootstrap will override it. On the other hand, if you place it after the import, all the Bootstrap code has finished compiling by the time you redefine the mixin (see Issue #240 and Issue #420). There is a potential that support for this latter option may be added in the future.

    Until then, one option I can think of (haven’t tested) would be to separate out the variables and mixins from the _bootstrap.scss in order that you can redefine the mixins prior to use.

    First, comment out the first two import statements in the _bootstrap.scss:

    // Core variables and mixins
    //@import "bootstrap/variables"; // Modify this for custom colors, font-sizes, etc
    //@import "bootstrap/mixins";
    

    Then in your SASS file which imports Bootstrap, it should be changed to include those:

    $btnPrimaryBackground: #f00;
    
    // Core variables and mixins
    @import "bootstrap/variables";
    @import "bootstrap/mixins";
    
    // Override of mixin for form field states
    @mixin formFieldState($textColor: #555, $borderColor: #ccc, $backgroundColor: #f5f5f5) {
      // customization here
    }
    
    @import "bootstrap";
    

    Under this workflow, you’d still be editing the vendor files, but at least you could restrict it to merely a couple lines commented out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm defining a form using the built-in 'form_for' utility. I have the bootstrap-sass gem
I'm using the 'bootstrap-sass' gem and can't find the .css file in my directory.
I'm using the rails gem Bootstrap SASS, and was wondering how I can overwrite
I've integrated bootstrap into my app using bootstrap-sass. The app works fine on my
The Bootstrap .dropdown-menu.pull-right selector doesn't seem to work (the code is in navbar.less, lines
I've started a Rails project and implemented bootstrap-sass into it. A short time later
I'm using Twitter Bootstrap 2.0.1 in a Rails 3.1.2 project, implemented with bootstrap-sass. I'm
I'm using compass and bootstrap for sass on a project. Everything works well. The
How can I overwrite the stylings in Twitter Bootstrap? For instance, I am currently
I've got a bunch of 'bootstrap' sass files I'd like to stick in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.