Sorry, I hit tab/space which auto-sent.  Let's try to finish this...

Basic idea is a template:

.card .ct-$(type.id()) {
  width: x;  /* etc. */
  color: $(type.color());
}

In truth, it is a little more complicated, because I have to make lots of
rules for all different classes, but the key element is that they have
different colors (at least), and I want to be able to define them based on
configuration that I loaded via AJAX, which defines the types.

Now, I need to take the existing CSS file, loop through all possible values
of object 'type' and then generate new CSS and make it be included in the
document.

I've seen the 'rules' plugin.  I suppose I could fetch my 'template' css
file, do find/replace on it to substitute the appropriate values (once per
type), and then use the Rules plugin to add the rules to the current
document.

But I wonder:  Is there a more elegant (client-side) solution?  Has anyone
else ever done client-side CSS rule generation based on data returned from
the database?  I'm just looking for people's ideas of 'best practices' since
I know that CSS doesn't yet support macros (right?).


On Fri, Jan 8, 2010 at 11:20 PM, John Arrowwood <j...@irie-inc.com> wrote:}

 --
John Arrowwood
John (at) Irie (dash) Inc (dot) com
John (at) Arrowwood Photography (dot) com
John (at) Hanlons Razor (dot) com
--
http://www.irie-inc.com/
http://arrowwood.blogspot.com/

Reply via email to