I'm building a site in Rails 3.2. Its been 3 years since I've touched Rails or Ruby, so I'm rusty on both, plus the last time I used rails is was Rails 2.3. Needless to say, please excuse any "simple" questions below.
Here are the specs
- Multi Tennant CMS/Store Site
- Each "Store" (aka sub-domain) can have its own look, feel, etc. through CSS customizations
- The customizations can be performed in a UI within the app allowing the user to change basic variables of Bootstrap (i.e.
@textColor
,@bodyBackground
, etc.)
- The customizations can be performed in a UI within the app allowing the user to change basic variables of Bootstrap (i.e.
- I'm using the
less-rails-bootstrap
gem to the Twitter Bootstrap look/feel, etc.
Here are the challenges
- I need to be able to dynamically output the variables for the CSS into a file that gets mixed in to Bootstrap so the variables are picked up to create the final CSS
- When a user changes a variable for the CSS, the existing style is basically invalidated. I need the full CSS recompiled and written back out to disk, memory stream, or some other location where I can get my hands on it (remember this is using
less
) - I need different CSS to spit out per sub-domain. Any suggestions on how to approach this?
Further complicating the matter...
...given that I essentially will have to find some way to compile the CSS on the fly, that means I have to include GEMS I typically would not in a production environment. Performance will be very important. Is there a way to isolate this? Once the CSS has been invalidated and regenerated, I could take the content and either write it out to disk or store is in some memcached/redis/etc. instance for performance.
Any comments, even if just to point me in a general direction would be appreciated.
Thanks!