Reputation: 6612
I have a multi-tenancy Rails app, where each tenant has an base_color
attribute which contains a hex color code. I have a variables.css.scss
file which contains Sass variables which are used in several other stylesheet files.
Now I want to use the tenant.base_color
variable to set the Sass variable $base_color
in variables.css.scss
, so the base color of the app changes according to the logged in tenant. Is this at all possible?
I tried to rename the file to variables.css.scss.erb
and then use this:
$base-color: <%= current_tenant.base_color %>;
But this doesn't work, I get an File to import not found or unreadable: variables.css.scss.
error.
Upvotes: 1
Views: 227
Reputation: 51151
It's not possible. css.scss
files are compiled to css once (when you run bundle exec rake assets:precompile
), so you can't make them dependant on some dynamic values. I guess you'd have to use inline css instead.
Upvotes: 1