Saturday, 17 August 2013

Use Handlebars to generate CSS?

Use Handlebars to generate CSS?

I'm wondering if Handlebars can be used like Liquid, to precompile and
generate dynamic CSS based on variables. I have tried the following code,
and it correctly outputs CSS, but as Handlebars is mainly targetted, is
there any drawbacks for this?
var template = Handlebars.compile("p + p { border-color: {{ borderColor }}
}");
var context = {borderColor: "#ffffff"};
var html = template(context);
Thanks

No comments:

Post a Comment