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 [mailto:dantehick...@gmail.com] >Sent: Saturday, 8 May 2010 5:52 AM >To: users@wicket.apache.org >Subject: CSS Templating > >All, > >I've been exploring the use of TextTemplateHeaderContributor.forCss method >to build a CSS template for multiple application. > >Take for example: > >IModel<Map<String, Object>> model = new >AbstractReadOnlyModel<Map<String,Object>>(){ > >private static final long serialVersionUID = 1L; > >@Override >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, >"Template.css", >model)); > >with CSS template: > >body{ > >background-color: ${body-bgcolor}; > >} > > > >The output works. However, the template is contributing to the header in >the >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: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org