views:

40

answers:

2

hi all

i am creating a cms / portal that i want each user to change certain css properise ie colors, widths, backgrounds etc to customise there own version of my site.

What is the best way to do this ? i have looked into sass but not sure if this is possible from front end as the css would need to be recompiled each time etc ?

Any one done this or got any suggestions please help.

thanks rick

A: 

Let the user edit an .scss file.

Use codemirror for editing.

SASSS

glebm
A: 

You can use sass if you like, but it's possible to do this using plain CSS too. Use whichever you prefer. Sass doesn't need to be recompiled for each request, it can be either:

  1. Pre-compiled at deploy time
  2. Served from a controller and page-cached

If you want your users to edit only certain properties then you can use a standard MVC approach to serve your stylesheets with page caching:

  1. Create a stylesheet model with the columns you want to have editable.
  2. Provide your users a form to manage their stylesheet (there are some good jQuery plugins for color selectors, etc.)
  3. Serve the stylesheets from a controller (e.g. routed to /users/1/stylesheet.css)
  4. Cache the stylesheet output using caches_page so it gets served statically on future requests.
Andrew Vit