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

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, "Template.css",

with CSS template:


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

Reply via email to