I can think of a couple approaches off the top of my head:
- Serve your stylesheet through a controller.
- Use CSS classes to configure the colors and serve just that CSS through a controller, inlined partial, or a CSS
@import
.
Serving your stylesheet through a controller is pretty straightforward so there's not much to say. This might be a bit ugly and cumbersome.
For the second one, you'd add a couple extra CSS classes:
.custom-bg {
background-color: some-default-bg;
}
.link-fg {
color: some-default-fg;
}
/*...*/
Then any element that need to use the custom background color would need their usual CSS classes and custom-bg
; similar shenanigans would be needed for the other configurable values. To supply the customized CSS, you could inline a <style>
element into your HTML using a standard ERB partial or you could serve the CSS through a controller (either through <style src="...">
or @import
). So you'd fake the SASSy goodness with old school multiple CSS classes in your HTML.
There's also JavaScript. You'd need some way to identify the elements that need their colors adjusted and then adjust them directly with things like this:
$('.need-custom-background').css('background-color', '...');