I am using RubySassCss to compile my sass files that looks like this:
styles.scss :
body{
&.template1{
$background-color: #fff;
@import "_template.scss";
}
&.template2{
$background-color: #000;
@import "_template.scss";
}
}
_template.scss:
div{
background-color: $background-color;
}
But i get this error :
Sass::SyntaxError: Undefined variable: "$background-color".
What i was trying to do here is a templating system based on sass variables, so if i change the body className the template (css values) changes too.
UPDATE :
When i replace @import "_template.scss";
with the content of my _template file the code works like a charm, but my real _template file is too long and i have many templates and a lot of vars, so i can't use this workaround.