I have a SCSS project that builds on top of Foundation through Compass. It defines a set of sass variables, then defines a bunch of rules in terms of these variables: (my project has many other variable parameters and import statements, this is simplified.)
vars.scss
$foo =
Then I use the compass to compile vars.scss , and everything works fine for this sass variable set. However, I also want the theme theme for my application to be different, and generate a different theme by defining a new set of variables that can override the original variables:
vars.scss
$foo =
I cannot edit the file manually when I have 70 themes. (Having many topics is necessary for the purposes of my application.) I really want to be able to do something like the following:
vars.scss
$foo =
And then I could call something like:
compass --otherVars themes/theme2
Then it would be easy to snatch all the topics, because I could call compass once for each topic.
Does SCSS allow this? I looked at him, and that doesn't look like him.
My current workaround is to split the original vars.scss into a prefix and suffix:
_app_prefix.scss
$foo =
_app_suffix.scss
@import '_rules';
app.scss
@import '_app_prefix'; // no overrides by default @import '_app_suffix';
And to override it for a specific topic, you must create a file that looks like this:
theme2.scss
@import '_app_prefix'; // only override $foo - let the original value of $bar stand $foo =
This works, but it is painful and introduces an additional pattern.
My next problem is to have @import 'rules_foo' extra instructions, which should also be built dynamically. So my overall fantasy would look like this:
vars.scss
$foo =
And I could call:
compass --otherVars themes/theme2 --rules "rules_1" "rules_2" "rules_3"
(Obviously, this is a little convenient, but I hope you get this idea.)
Is there any way to do this? Or will I have to resort to steering wheels or another template?