Exactly, Steve!
You solution is great! Thanks a lot :)

-----Original Message-----
From: Steve Eynon [mailto:steve.ey...@alienfactory.co.uk] 
Sent: Mittwoch, 28. September 2011 19:53
To: Tapestry users
Subject: Re: CSS for all pages

Ah, cheers Thiago!

I think Wulf was saying the CSS was part of a separate module he
wouldn't have direct access to the Layout component - in that case he
could use the Worker to single out the Layout and just add the Mixin
to that.

---------- Forwarded message ----------
From: Thiago H. de Paula Figueiredo <thiag...@gmail.com>
Date: 29 September 2011 01:27
Subject: Re: CSS for all pages
To: Steve Eynon <steve.ey...@alienfactory.co.uk>

Awesome use of a component class transformation and a mixin, Steve! :)

Wulf, I'd say almost all Tapestry projects have a Layout component
used in all pages, so @Import'ing your CSS or JavaScript in it makes
them being added to all pages.


On Wed, 28 Sep 2011 13:39:56 -0300, Steve Eynon
<steve.ey...@alienfactory.co.uk> wrote:

> There may be an easier way, but you could have a worker to add a Mixin
> / Component to each page which has no markup, but @Import's your CSS.
>
> In T5.3 it's :
>
> public class EmbedCssMixinInEveryPageWorker implements
> ComponentClassTransformWorker2 {
>        public void transform(PlasticClass plasticClass,
> TransformationSupport support, MutableComponentModel model) {
>                if (model.isPage())
>                        model.addMixinClassName(CssMixin.class.getName());
>        }
> }
>
> @Import(stylesheet="context:myApp.css")
> public class CssMixin {
> }
>
> in your module, add
>
> public static void
> contributeComponentClassTransformWorker(OrderedConfiguration<ComponentClassTransformWorker2>
> configuration) {
>        configuration.addInstance("CssMixin", 
> EmbedCssMixinInEveryPageWorker.class);
> }
>
> Steve.
>
> On 29 September 2011 00:24, Wechsung, Wulf <wulf.wechs...@sap.com> wrote:
>>
>> Hello Guys,
>>
>> I was wondering if it is at all possible to add a global (ie included in all 
>> pages) CSS from a module. Basically just like the tapestry framework  adds 
>> the default.css to any page in your tapestry web app I would like to have a 
>> webapp that loads a module that includes a CSS in all the pages of the app. 
>> The use-case is that I need to add some CSS fixes that should go into all 
>> apps that use the module auto-magically as is the case with filters and 
>> services.
>>
>> Thanks and kind Regards,
>> Wulf
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant,
developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to