From @stepheneb on April 3, 2017 17:13
In a very simple rails 5.0.1.rc1 application a sass variable defined in the file colors.scss is available in application.scss (the file that imports colors.scss) but not in a second file, welcome.scss imported by application.scss.
file: colors.scss
$backgroundcolor: rgb(200, 117, 216);
file: application.scss
@import 'colors';
p {
color: $backgroundcolor;
}
This works correctly.
However if I remove the p styling from application.scss and instead reference it from a second file welcome.scss Rails generates an Undefined variable: "$backgroundcolor". error when rendering.
file: application.scss
@import 'colors';
@import 'welcome';
file: welcome.scss
p {
color: $backgroundcolor;
}
Earlier I described this bug in a rails issue: rails/rails#28628 however I think the bug might be in the sass-rails gem.
Copied from original issue: rails/sass-rails#396
From @stepheneb on April 3, 2017 17:13
In a very simple rails 5.0.1.rc1 application a sass variable defined in the file
colors.scssis available inapplication.scss(the file that importscolors.scss) but not in a second file,welcome.scssimported byapplication.scss.file:
colors.scssfile:
application.scssThis works correctly.
However if I remove the p styling from
application.scssand instead reference it from a second filewelcome.scssRails generates anUndefined variable: "$backgroundcolor".error when rendering.file:
application.scssfile:
welcome.scssEarlier I described this bug in a rails issue: rails/rails#28628 however I think the bug might be in the sass-rails gem.
Copied from original issue: rails/sass-rails#396