Search code examples
ruby-on-railstwitter-bootstraptwitter-bootstrap-rails

Can't get twitter-bootstrap-rails mixin to work


I have the following piece of CSS in app/assets/stylesheets/scaffolds.scss:

.input-container {
    @include make-lg-column(3);
}

When I load the page I get the following error:

Undefined mixin 'make-lg-column'.

I have the following lines present in app/assets/stylesheets/bootstrap_and_overrides.css.less:

@import "twitter/bootstrap/variables.less";
@import "twitter/bootstrap/mixins.less";

This is what I have in app/assets/stylesheets/application.css:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require bootstrap_and_overrides
 *= require_tree .
 *= require_self
 */

Any suggestions on how to troubleshoot this would be appreciated.


Solution

  • You seem to use bootstrap with LESS in a SCSS file. I'd suggest to try the SASS version.

    # Gemfile
    gem 'bootstrap-sass', '~> 3.3.7'
    gem 'sass-rails', '>= 3.2'
    
    # SCSS file
    @import "bootstrap-sprockets";
    @import "bootstrap";