thoughtbot / neat

A fluid and flexible grid Sass framework
https://neat.bourbon.io/
MIT License
4.42k stars 424 forks source link

Sass::SyntaxError: Undefined variable: "$all-buttons" #401

Closed keeganwade closed 8 years ago

keeganwade commented 8 years ago

In using bourbon, neat, and bitters in a rails project, I am encountering the following error:

Sass::SyntaxError: Undefined variable: "$all-buttons".
...app/assets/stylesheets/base/_buttons.scss:1
...app/assets/stylesheets/base/_base.scss:14

I also receive this same error when I run rake assets:precompile. The contents of my application.scss are this:

@import 'normalize';
@import 'bourbon';
@import 'base/base';
@import 'neat';
@import 'layout/layout';

My _base.scss includes:

@import "variables";
@import "grid-settings";
@import "buttons";
@import "forms";
. . .

My gemfile includes:

gem 'bourbon'
gem 'neat'
gem 'bitters'

I've tried re-arranging files along the lines of the stack overflow post here, and I've tried running versions 1.7.1 and 1.7.2 of the neat gem as per the issue here, as I thought perhaps there may be some kind of connection to these, but no dice.

tysongach commented 8 years ago

@keeganwade The $all-buttons variable is part of Bourbon, but wasn’t introduced until Bourbon v4.2, specifically. Are you using Bourbon v4.2 or above? If not, is upgrading an option?

If you can’t upgrade Bourbon, try swapping #{$all-buttons} for #{$all-button-inputs}, button within _buttons.scss in your Bitters instance.

A little background: right now, $all-buttons is equal to $all-button-inputs; it’s in a slight name transition phase so to speak. When we release Bourbon v5, we’ll deprecate $all-button-inputs, so the most future-friendly option here is to update Bourbon.

keeganwade commented 8 years ago

Thanks for your quick reply. I have been using Bourbon v4.2.6.

Your comment helped me to realize that Bitters simply must be loading from somewhere in advance of Bourbon in my rails app. It then occurred to me that I had recently added the following line of code to my assets.rb file:

Rails.application.config.assets.precompile =  ['*.js', 'application.scss', '*.scss', '*.css.erb']

And that perhaps the scss files are being loaded in an undesirable order. When I use this line of code instead:

Rails.application.config.assets.precompile =  ['*.js', 'application.scss', '*.css.erb']

The problem disappears and things load correctly. Your question about versioning dependencies between Bourbon and Bitters helped me realize this - many thanks. Also, I realize I should have submitted this issue under the Bourbon or Bitters codebase, not Neat - my apologies.