That method of css generation you propose would be generating CSS (even
if it were into a separate .css file) with each page render. If you're
dealing with a lot of CSS that probably isn't the most efficient method.

Generating CSS at render time would mean the browser could not take
advantage of CSS caching - which would be bad in these days of quite
large CSS files.

You might be better off considering a separate CSS generator that
doesn't generate CSS at 'page render time'.

>-----Original Message-----
>From: Eric Hamel []
>Sent: Saturday, 8 May 2010 5:52 AM
>Subject: CSS Templating
>I've been exploring the use of TextTemplateHeaderContributor.forCss
>to build a CSS template for multiple application.
>Take for example:
>IModel<Map<String, Object>> model = new
>private static final long serialVersionUID = 1L;
>public Map<String, Object> getObject() {
> HashMap<String,Object> map = new HashMap<String, Object>();
>map.put("body-bgcolor", "red");
> return map;
> add(TextTemplateHeaderContributor.forCss(WelcomePage.class,
>with CSS template:
>background-color: ${body-bgcolor};
>The output works. However, the template is contributing to the header
>form of:
><style type="text/css"><!-- body{ background-color: red; }--></style>
>which is unacceptable. Is there a way to generate a .css file to be
used by
>the application ?
>Thank you
>Sent by Eric Hamel

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to