Re: CSS Templating
Agreed. This is what I ended up doing. Thanks for the ideas all. On Mon, May 10, 2010 at 3:28 PM, Jeremy Thomerson jer...@wickettraining.com wrote: Instead of doing this, use cascading stylesheets like they were intended to be used: In both applications, have a global.css or similar that handles all of the layout, etc, that is common to both sites. Then, in each application, include a appXYZ.css that simply changes colors, background images, etc, that you would presumably be doing on a per-site basis. -- Jeremy Thomerson http://www.wickettraining.com On Mon, May 10, 2010 at 7:17 AM, Eric Hamel dantehick...@gmail.com wrote: Good Point. In all honesty, I'm looking for a practical way to skin 2 applications which are identical layout wise. Inherently, I don't want to manage 2 different stylesheets as that will lead to maintenance hell. The idea was to build a Template implemented in both applications to which I would override/pass to the template colors/background-colors/background-image. Might not be the best approach... On Sat, May 8, 2010 at 3:42 AM, Chris Colman chr...@stepaheadsoftware.comwrote: 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: IModelMapString, Object model = new AbstractReadOnlyModelMapString,Object(){ private static final long serialVersionUID = 1L; @Override public MapString, Object getObject() { HashMapString,Object map = new HashMapString, 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 -- Sent by Eric Hamel -- Sent by Eric Hamel
Re: CSS Templating
Good Point. In all honesty, I'm looking for a practical way to skin 2 applications which are identical layout wise. Inherently, I don't want to manage 2 different stylesheets as that will lead to maintenance hell. The idea was to build a Template implemented in both applications to which I would override/pass to the template colors/background-colors/background-image. Might not be the best approach... On Sat, May 8, 2010 at 3:42 AM, Chris Colman chr...@stepaheadsoftware.comwrote: 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: IModelMapString, Object model = new AbstractReadOnlyModelMapString,Object(){ private static final long serialVersionUID = 1L; @Override public MapString, Object getObject() { HashMapString,Object map = new HashMapString, 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 -- Sent by Eric Hamel
Re: CSS Templating
Instead of doing this, use cascading stylesheets like they were intended to be used: In both applications, have a global.css or similar that handles all of the layout, etc, that is common to both sites. Then, in each application, include a appXYZ.css that simply changes colors, background images, etc, that you would presumably be doing on a per-site basis. -- Jeremy Thomerson http://www.wickettraining.com On Mon, May 10, 2010 at 7:17 AM, Eric Hamel dantehick...@gmail.com wrote: Good Point. In all honesty, I'm looking for a practical way to skin 2 applications which are identical layout wise. Inherently, I don't want to manage 2 different stylesheets as that will lead to maintenance hell. The idea was to build a Template implemented in both applications to which I would override/pass to the template colors/background-colors/background-image. Might not be the best approach... On Sat, May 8, 2010 at 3:42 AM, Chris Colman chr...@stepaheadsoftware.comwrote: 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: IModelMapString, Object model = new AbstractReadOnlyModelMapString,Object(){ private static final long serialVersionUID = 1L; @Override public MapString, Object getObject() { HashMapString,Object map = new HashMapString, 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 -- Sent by Eric Hamel
Re: CSS Templating
usually you would simply write a servlet to do it, but if you insist on doing it in wicket... https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html -igor On Fri, May 7, 2010 at 12:52 PM, Eric Hamel dantehick...@gmail.com wrote: All, I've been exploring the use of TextTemplateHeaderContributor.forCss method to build a CSS template for multiple application. Take for example: IModelMapString, Object model = new AbstractReadOnlyModelMapString,Object(){ private static final long serialVersionUID = 1L; @Override public MapString, Object getObject() { HashMapString,Object map = new HashMapString, 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
RE: CSS Templating
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: IModelMapString, Object model = new AbstractReadOnlyModelMapString,Object(){ private static final long serialVersionUID = 1L; @Override public MapString, Object getObject() { HashMapString,Object map = new HashMapString, 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
Re: CSS Templating
If you are trying to achieve css variables, you may want to consider using wro4j: (http://code.google.com/p/wro4j/wiki/GettingStarted). It does support css variables, besides other dozen features (like less css meta framework integration, merge, minification, cache, build time runtime solution, etc). It integrates very easy in any j2ee application and is compatible with jdk-1.5 servlet-api-2.3. Alex Objelean -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CSS-Templating-tp2135587p2136149.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
CSS Templating
All, I've been exploring the use of TextTemplateHeaderContributor.forCss method to build a CSS template for multiple application. Take for example: IModelMapString, Object model = new AbstractReadOnlyModelMapString,Object(){ private static final long serialVersionUID = 1L; @Override public MapString, Object getObject() { HashMapString,Object map = new HashMapString, 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