PDA

View Full Version : Setting SASS touch variables with JS and updating CSS accordingly



oddz
4 Dec 2011, 11:08 AM
Has anyone thought about creating a way to set SASS variables from javaScript and have everything update accordingly? The reason I ask is because I am building a single application that will be deployed about 13 times with slightly different theming. Which means at this time I need to have 13 SASS files. However, if I was able to actually set things like base color via JavaScript I would only need a single base SASS file.

anyone?

mitchellsimoens
5 Dec 2011, 10:59 AM
But how would you compile them? You can't in Javascript... you have to create them separately and then compile them in terminal or command line.

oddz
5 Dec 2011, 11:14 AM
Well the way I have been considering for $base-color is to update the styles inline which base color would affect. Of course that would mean going through all the CSS and determining which elements and properties need to change. Even more complex than that would be replicating any functionality provided by custom mixins such as; lighten, saturate etc. However, for my purposes I don't believe I will need that. That said, I don't think it would be a valuable use of my time.