you can add additional HTML nodes to your document whenever you want. all you need is the MarkupWriter:
Element e = writer.getDocument().getRootElement().find("head"); e.element("link",....) // adds new element you could also contribute a css helper class that implements PageRenderCommand to the contributePageRenderInitializer service. any component could then reference this object through @Enviromental CSSHelper css; ... css.addCss("...."); when the cleanup method is invoked you could use the first code snippet to generate a link node for every contributed css file. g, kris "Janko Muzykant" <[EMAIL PROTECTED]> 02.07.2007 14:41 Bitte antworten an "Tapestry users" <users@tapestry.apache.org> An "Tapestry users" <users@tapestry.apache.org> Kopie Thema Re: T5 optional css for component hi Marcus, this solution is perfect provided i have a <html><head>....</head></html> template defined separately for each page. but usually this is written once in some "Border" or "Layout" component's template. In such a case I cannot predict how many css links will be placed inside <head> section because many pages will use the same layout component. I would need something like this: (Layout.html) <head> <t:loop source="cssCollection" value="css"> <link href="${css}" rel="stylesheet" type="text/css"/> </t:loop> </head> (Layout.java) class Layout { private List<String> cssCollection; ... } but the question is: how to fill up the cssCollection array with css links of all components of given page before the page starts rendering? On 7/2/07, Marcus <[EMAIL PROTECTED]> wrote: > > Hi Janko, > > You could try: > > @Inject > @Path("context:assets/css/layout.css") > private Asset _layoutCss; > > public Asset getLayoutCss() { > if (yourCondition) > return _layoutCss; > else > return ""; > } > > > <head> > <link href="${layoutCss}" rel="stylesheet" type="text/css"/> > </head> > > > Marcus >