You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Beat Durrer <bd...@gmail.com> on 2012/03/19 16:50:58 UTC

Define stylesheet import order

Hi all,

I have a "RootLayout" component which loads a CSS file, and some
SubLayout components add an other CSS.
I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
the Layout classes.

At the moment, the CSS from RootLayout is loaded after the SubLayouts
and therefore overrides theCSS styles.
Can I somehow control in which order those stylesheets are loaded? How?


Thanks in advance :-)
Beat

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


Re: Define stylesheet import order

Posted by Beat Durrer <bd...@gmail.com>.
The Idea with mixins is great.
Even simpler: Since I always use the same RootLayout as uppermost
component, I could simply add some method to add/manage the page's
CSS.

I was able to solve the issue by reducing the amount of nested layout
components to a maximum of two
Then I put the @Import on the afterRender of the inner (ergo most
specific) components.
That way the uppermost RootLayout CSS comes first and the nested
InnerLayout's CSS is second.



2012/3/20 Thiago H. de Paula Figueiredo <th...@gmail.com>:
> On Tue, 20 Mar 2012 13:37:26 -0300, Lance Java <la...@googlemail.com>
> wrote:
>
>> Perhaps you could write a MarkupRendererFilter that gets the "html/head"
>> element and loops through all of the "link" elements calling moveToTop()
>> on each (thus reversing the order).
>
>
> You could do that in a mixin added to the root layout component instead. No
> need for MarkupRendererFilter in this case.
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Define stylesheet import order

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 20 Mar 2012 13:37:26 -0300, Lance Java <la...@googlemail.com>  
wrote:

> Perhaps you could write a MarkupRendererFilter that gets the "html/head"
> element and loops through all of the "link" elements calling moveToTop()  
> on each (thus reversing the order).

You could do that in a mixin added to the root layout component instead.  
No need for MarkupRendererFilter in this case.

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

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


Re: Define stylesheet import order

Posted by Lance Java <la...@googlemail.com>.
I have a hunch that the reverse order that you are seeing is a direct
result of tapestry's RenderQueueImpl which iterates tail first.

Perhaps you could write a MarkupRendererFilter that gets the "html/head"
element and loops through all of the "link" elements calling moveToTop() on
each (thus reversing the order).

On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
> Yeah, you're probably right about the priority having it's own issues.
> I wonder if there is a case, in which the current ordering (reversed
> to my needs) is actually required?
> In my opinion the innermost element is the most specific one and
> therefore should have the last word (and be the last one to have it's
> css added).
> So maybe reversing the order of the includes is all that's needed...
> I'll add a Jira issue tomorrow.
>
>
> Meanwhile, I just tried to add the CSS directly into the template.
> I added a <link type="text/css"../> to the RootLayout, but to my
> suprise, the @Import includes the CSS *after* this link.
> I found an Jira isse about that (TAP5-1330) but that is marked as
> fixed in T5.2 (I'm using T5.3.2).
>
>
>
> 2012/3/20 Lance Java <la...@googlemail.com>:
>> I agree that tapestry could be a bit smarter when components/layouts
extend
>> each other. This improvement could be made without adding a
priority/order
>> to the @Import annotation. I think this is worthy of a Jira issue.
>>
>> As I mentioned before, adding a priority/order to the @Import annotation
>> could have issues when stacks are used or when two @Imports for the same
>> asset have a different order/priority. I think this requires a bit more
>> thought.
>>
>> On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>> I did some tests and the order of the stylesheets is actually reversed
>>> to what I expected it to be...
>>>
>>> Here is an example:
>>>
>>> Let's say we define a RootLayout, which has all the basics ( <html>
>>> tag, meta stuff, the <body> tag).
>>> Then we have a SimpleLayout which uses the RootLayout but adds a top
>>> navigation to it.
>>> Next is a TwoColumnLayout which uses the SimpleLayout and introduces
>>> two columns ( t:body and a t:delegate for the sidebar, as in the T5
>>> archetype)
>>> Then we have some SpecialCaseLayout which uses the TwoColumn, but does
>>> some specific magic and overrides some CSS and adds some elements.
>>>
>>> All those components have an own, specific @import stylesheet.
>>>
>>> What I would expect is that the CSS come in this order: RootLayout,
>>> SimpleLayout, TwoColumnLayout, SpecialCaseLayout.
>>> That way you would be able to override whatever you need in your
>>> SpecialCaseLayout
>>>
>>> Currently T5.3.2 renders in the opposite order.
>>> Would be nice to have an order parameter, similar to ordered
>>> configurations (like "after:TwoColumnLayout.css")
>>>
>>>
>>>
>>> 2012/3/20 Lance Java <la...@googlemail.com>:
>>>> For each component, Tapestry includes the stylesheets and javascript
for
>>>> each making sure to only include each unique file once. I'm not 100%
but
>> I
>>>> guess that the order in which the components appear in the page
probably
>>>> defines the order in which they appear in the page.
>>>>
>>>> What would be nice is if you could contribute a preferred order for
>>>> @Includes to JavaScriptSupport although I have no idea how this would
>> work
>>>> when stacks are used. Looking through TapestryModule it doesn't look
very
>>>> easy to override JavaScriptSupportImpl without copy/pasting quite a bit
>> of
>>>> code. I would stick with a MarkupRendererFilter for now.
>>>>
>>>> Another option would be to include a priority in the @Import
annotation.
>>>> Again, I'm not sure this would work with stacks or what would happen
for
>>>> two @Imports for the same asset with different priorities.
>>>>
>>>> As you said, you could handle stylesheets yourself. Probably by
including
>>>> all stylesheets in your Layout component and avoid using @Import
>>>> annotations.
>>>>
>>>> On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>>>> Thanks for your help Lance, I'm sure it could work that way.
>>>>>
>>>>> I am a bit suprised that there is no direct solution to this. It's
>>>>> common to have some libraries or default CSS and override them on
>>>>> specific pages / layouts.
>>>>> Making CSS special cases or writing an own MarkupRendererFilter for an
>>>>> issue that could be solved by placing the CSS links in the correct
>>>>> order seems like a big overkill to me.
>>>>>
>>>>> I rather go back to writing the CSS include myself than jumping
through
>>>> hoops.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2012/3/19 Lance Java <la...@googlemail.com>:
>>>>>> In your AppModule, you can contribute a MarkupRendererFilter to fire
>>>> after
>>>>>> JavaScriptSupport
>>>>>>
>>>>>>    public void
>>>>>> contributeMark

Re: Define stylesheet import order

Posted by Beat Durrer <bd...@gmail.com>.
Yeah, you're probably right about the priority having it's own issues.
I wonder if there is a case, in which the current ordering (reversed
to my needs) is actually required?
In my opinion the innermost element is the most specific one and
therefore should have the last word (and be the last one to have it's
css added).
So maybe reversing the order of the includes is all that's needed...
I'll add a Jira issue tomorrow.


Meanwhile, I just tried to add the CSS directly into the template.
I added a <link type="text/css"../> to the RootLayout, but to my
suprise, the @Import includes the CSS *after* this link.
I found an Jira isse about that (TAP5-1330) but that is marked as
fixed in T5.2 (I'm using T5.3.2).



2012/3/20 Lance Java <la...@googlemail.com>:
> I agree that tapestry could be a bit smarter when components/layouts extend
> each other. This improvement could be made without adding a priority/order
> to the @Import annotation. I think this is worthy of a Jira issue.
>
> As I mentioned before, adding a priority/order to the @Import annotation
> could have issues when stacks are used or when two @Imports for the same
> asset have a different order/priority. I think this requires a bit more
> thought.
>
> On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>> I did some tests and the order of the stylesheets is actually reversed
>> to what I expected it to be...
>>
>> Here is an example:
>>
>> Let's say we define a RootLayout, which has all the basics ( <html>
>> tag, meta stuff, the <body> tag).
>> Then we have a SimpleLayout which uses the RootLayout but adds a top
>> navigation to it.
>> Next is a TwoColumnLayout which uses the SimpleLayout and introduces
>> two columns ( t:body and a t:delegate for the sidebar, as in the T5
>> archetype)
>> Then we have some SpecialCaseLayout which uses the TwoColumn, but does
>> some specific magic and overrides some CSS and adds some elements.
>>
>> All those components have an own, specific @import stylesheet.
>>
>> What I would expect is that the CSS come in this order: RootLayout,
>> SimpleLayout, TwoColumnLayout, SpecialCaseLayout.
>> That way you would be able to override whatever you need in your
>> SpecialCaseLayout
>>
>> Currently T5.3.2 renders in the opposite order.
>> Would be nice to have an order parameter, similar to ordered
>> configurations (like "after:TwoColumnLayout.css")
>>
>>
>>
>> 2012/3/20 Lance Java <la...@googlemail.com>:
>>> For each component, Tapestry includes the stylesheets and javascript for
>>> each making sure to only include each unique file once. I'm not 100% but
> I
>>> guess that the order in which the components appear in the page probably
>>> defines the order in which they appear in the page.
>>>
>>> What would be nice is if you could contribute a preferred order for
>>> @Includes to JavaScriptSupport although I have no idea how this would
> work
>>> when stacks are used. Looking through TapestryModule it doesn't look very
>>> easy to override JavaScriptSupportImpl without copy/pasting quite a bit
> of
>>> code. I would stick with a MarkupRendererFilter for now.
>>>
>>> Another option would be to include a priority in the @Import annotation.
>>> Again, I'm not sure this would work with stacks or what would happen for
>>> two @Imports for the same asset with different priorities.
>>>
>>> As you said, you could handle stylesheets yourself. Probably by including
>>> all stylesheets in your Layout component and avoid using @Import
>>> annotations.
>>>
>>> On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>>> Thanks for your help Lance, I'm sure it could work that way.
>>>>
>>>> I am a bit suprised that there is no direct solution to this. It's
>>>> common to have some libraries or default CSS and override them on
>>>> specific pages / layouts.
>>>> Making CSS special cases or writing an own MarkupRendererFilter for an
>>>> issue that could be solved by placing the CSS links in the correct
>>>> order seems like a big overkill to me.
>>>>
>>>> I rather go back to writing the CSS include myself than jumping through
>>> hoops.
>>>>
>>>>
>>>>
>>>>
>>>> 2012/3/19 Lance Java <la...@googlemail.com>:
>>>>> In your AppModule, you can contribute a MarkupRendererFilter to fire
>>> after
>>>>> JavaScriptSupport
>>>>>
>>>>>    public void
>>>>> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
>>>>> configuration) {
>>>>>        configuration.addInstance("MyMarkupRendererFilter",
>>>>> MyMarkupRendererFilter.class, "after:JavaScriptSupport");
>>>>>    }
>>>>>
>>>>> MyMarkupRendererFilter can use then manipulate the MarkupWriter's DOM
>>>>> before it is written to the response output stream
>>>>>
>>>>>
>>>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/MarkupWriter.html
>>>>>
>>>>> On Monday, 19 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> I have a "RootLayout" component which loads a CSS file, and some
>>>>>> SubLayout components add an other CSS.
>>>>>> I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
>>>>>> the Layout classes.
>>>>>>
>>>>>> At the moment, the CSS from RootLayout is loaded after the SubLayouts
>>>>>> and therefore overrides theCSS styles.
>>>>>> Can I somehow control in which order those stylesheets are loaded?
> How?
>>>>>>
>>>>>>
>>>>>> Thanks in advance :-)
>>>>>> Beat
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apach

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


Re: Define stylesheet import order

Posted by Lance Java <la...@googlemail.com>.
I agree that tapestry could be a bit smarter when components/layouts extend
each other. This improvement could be made without adding a priority/order
to the @Import annotation. I think this is worthy of a Jira issue.

As I mentioned before, adding a priority/order to the @Import annotation
could have issues when stacks are used or when two @Imports for the same
asset have a different order/priority. I think this requires a bit more
thought.

On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
> I did some tests and the order of the stylesheets is actually reversed
> to what I expected it to be...
>
> Here is an example:
>
> Let's say we define a RootLayout, which has all the basics ( <html>
> tag, meta stuff, the <body> tag).
> Then we have a SimpleLayout which uses the RootLayout but adds a top
> navigation to it.
> Next is a TwoColumnLayout which uses the SimpleLayout and introduces
> two columns ( t:body and a t:delegate for the sidebar, as in the T5
> archetype)
> Then we have some SpecialCaseLayout which uses the TwoColumn, but does
> some specific magic and overrides some CSS and adds some elements.
>
> All those components have an own, specific @import stylesheet.
>
> What I would expect is that the CSS come in this order: RootLayout,
> SimpleLayout, TwoColumnLayout, SpecialCaseLayout.
> That way you would be able to override whatever you need in your
> SpecialCaseLayout
>
> Currently T5.3.2 renders in the opposite order.
> Would be nice to have an order parameter, similar to ordered
> configurations (like "after:TwoColumnLayout.css")
>
>
>
> 2012/3/20 Lance Java <la...@googlemail.com>:
>> For each component, Tapestry includes the stylesheets and javascript for
>> each making sure to only include each unique file once. I'm not 100% but
I
>> guess that the order in which the components appear in the page probably
>> defines the order in which they appear in the page.
>>
>> What would be nice is if you could contribute a preferred order for
>> @Includes to JavaScriptSupport although I have no idea how this would
work
>> when stacks are used. Looking through TapestryModule it doesn't look very
>> easy to override JavaScriptSupportImpl without copy/pasting quite a bit
of
>> code. I would stick with a MarkupRendererFilter for now.
>>
>> Another option would be to include a priority in the @Import annotation.
>> Again, I'm not sure this would work with stacks or what would happen for
>> two @Imports for the same asset with different priorities.
>>
>> As you said, you could handle stylesheets yourself. Probably by including
>> all stylesheets in your Layout component and avoid using @Import
>> annotations.
>>
>> On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>> Thanks for your help Lance, I'm sure it could work that way.
>>>
>>> I am a bit suprised that there is no direct solution to this. It's
>>> common to have some libraries or default CSS and override them on
>>> specific pages / layouts.
>>> Making CSS special cases or writing an own MarkupRendererFilter for an
>>> issue that could be solved by placing the CSS links in the correct
>>> order seems like a big overkill to me.
>>>
>>> I rather go back to writing the CSS include myself than jumping through
>> hoops.
>>>
>>>
>>>
>>>
>>> 2012/3/19 Lance Java <la...@googlemail.com>:
>>>> In your AppModule, you can contribute a MarkupRendererFilter to fire
>> after
>>>> JavaScriptSupport
>>>>
>>>>    public void
>>>> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
>>>> configuration) {
>>>>        configuration.addInstance("MyMarkupRendererFilter",
>>>> MyMarkupRendererFilter.class, "after:JavaScriptSupport");
>>>>    }
>>>>
>>>> MyMarkupRendererFilter can use then manipulate the MarkupWriter's DOM
>>>> before it is written to the response output stream
>>>>
>>>>
>>
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/MarkupWriter.html
>>>>
>>>> On Monday, 19 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>>>> Hi all,
>>>>>
>>>>> I have a "RootLayout" component which loads a CSS file, and some
>>>>> SubLayout components add an other CSS.
>>>>> I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
>>>>> the Layout classes.
>>>>>
>>>>> At the moment, the CSS from RootLayout is loaded after the SubLayouts
>>>>> and therefore overrides theCSS styles.
>>>>> Can I somehow control in which order those stylesheets are loaded?
How?
>>>>>
>>>>>
>>>>> Thanks in advance :-)
>>>>> Beat
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apach

Re: Define stylesheet import order

Posted by Beat Durrer <bd...@gmail.com>.
I did some tests and the order of the stylesheets is actually reversed
to what I expected it to be...

Here is an example:

Let's say we define a RootLayout, which has all the basics ( <html>
tag, meta stuff, the <body> tag).
Then we have a SimpleLayout which uses the RootLayout but adds a top
navigation to it.
Next is a TwoColumnLayout which uses the SimpleLayout and introduces
two columns ( t:body and a t:delegate for the sidebar, as in the T5
archetype)
Then we have some SpecialCaseLayout which uses the TwoColumn, but does
some specific magic and overrides some CSS and adds some elements.

All those components have an own, specific @import stylesheet.

What I would expect is that the CSS come in this order: RootLayout,
SimpleLayout, TwoColumnLayout, SpecialCaseLayout.
That way you would be able to override whatever you need in your
SpecialCaseLayout

Currently T5.3.2 renders in the opposite order.
Would be nice to have an order parameter, similar to ordered
configurations (like "after:TwoColumnLayout.css")



2012/3/20 Lance Java <la...@googlemail.com>:
> For each component, Tapestry includes the stylesheets and javascript for
> each making sure to only include each unique file once. I'm not 100% but I
> guess that the order in which the components appear in the page probably
> defines the order in which they appear in the page.
>
> What would be nice is if you could contribute a preferred order for
> @Includes to JavaScriptSupport although I have no idea how this would work
> when stacks are used. Looking through TapestryModule it doesn't look very
> easy to override JavaScriptSupportImpl without copy/pasting quite a bit of
> code. I would stick with a MarkupRendererFilter for now.
>
> Another option would be to include a priority in the @Import annotation.
> Again, I'm not sure this would work with stacks or what would happen for
> two @Imports for the same asset with different priorities.
>
> As you said, you could handle stylesheets yourself. Probably by including
> all stylesheets in your Layout component and avoid using @Import
> annotations.
>
> On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>> Thanks for your help Lance, I'm sure it could work that way.
>>
>> I am a bit suprised that there is no direct solution to this. It's
>> common to have some libraries or default CSS and override them on
>> specific pages / layouts.
>> Making CSS special cases or writing an own MarkupRendererFilter for an
>> issue that could be solved by placing the CSS links in the correct
>> order seems like a big overkill to me.
>>
>> I rather go back to writing the CSS include myself than jumping through
> hoops.
>>
>>
>>
>>
>> 2012/3/19 Lance Java <la...@googlemail.com>:
>>> In your AppModule, you can contribute a MarkupRendererFilter to fire
> after
>>> JavaScriptSupport
>>>
>>>    public void
>>> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
>>> configuration) {
>>>        configuration.addInstance("MyMarkupRendererFilter",
>>> MyMarkupRendererFilter.class, "after:JavaScriptSupport");
>>>    }
>>>
>>> MyMarkupRendererFilter can use then manipulate the MarkupWriter's DOM
>>> before it is written to the response output stream
>>>
>>>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/MarkupWriter.html
>>>
>>> On Monday, 19 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>>> Hi all,
>>>>
>>>> I have a "RootLayout" component which loads a CSS file, and some
>>>> SubLayout components add an other CSS.
>>>> I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
>>>> the Layout classes.
>>>>
>>>> At the moment, the CSS from RootLayout is loaded after the SubLayouts
>>>> and therefore overrides theCSS styles.
>>>> Can I somehow control in which order those stylesheets are loaded? How?
>>>>
>>>>
>>>> Thanks in advance :-)
>>>> Beat
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>

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


Re: Define stylesheet import order

Posted by Lance Java <la...@googlemail.com>.
For each component, Tapestry includes the stylesheets and javascript for
each making sure to only include each unique file once. I'm not 100% but I
guess that the order in which the components appear in the page probably
defines the order in which they appear in the page.

What would be nice is if you could contribute a preferred order for
@Includes to JavaScriptSupport although I have no idea how this would work
when stacks are used. Looking through TapestryModule it doesn't look very
easy to override JavaScriptSupportImpl without copy/pasting quite a bit of
code. I would stick with a MarkupRendererFilter for now.

Another option would be to include a priority in the @Import annotation.
Again, I'm not sure this would work with stacks or what would happen for
two @Imports for the same asset with different priorities.

As you said, you could handle stylesheets yourself. Probably by including
all stylesheets in your Layout component and avoid using @Import
annotations.

On Tuesday, 20 March 2012, Beat Durrer <bd...@gmail.com> wrote:
> Thanks for your help Lance, I'm sure it could work that way.
>
> I am a bit suprised that there is no direct solution to this. It's
> common to have some libraries or default CSS and override them on
> specific pages / layouts.
> Making CSS special cases or writing an own MarkupRendererFilter for an
> issue that could be solved by placing the CSS links in the correct
> order seems like a big overkill to me.
>
> I rather go back to writing the CSS include myself than jumping through
hoops.
>
>
>
>
> 2012/3/19 Lance Java <la...@googlemail.com>:
>> In your AppModule, you can contribute a MarkupRendererFilter to fire
after
>> JavaScriptSupport
>>
>>    public void
>> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
>> configuration) {
>>        configuration.addInstance("MyMarkupRendererFilter",
>> MyMarkupRendererFilter.class, "after:JavaScriptSupport");
>>    }
>>
>> MyMarkupRendererFilter can use then manipulate the MarkupWriter's DOM
>> before it is written to the response output stream
>>
>>
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/MarkupWriter.html
>>
>> On Monday, 19 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>>> Hi all,
>>>
>>> I have a "RootLayout" component which loads a CSS file, and some
>>> SubLayout components add an other CSS.
>>> I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
>>> the Layout classes.
>>>
>>> At the moment, the CSS from RootLayout is loaded after the SubLayouts
>>> and therefore overrides theCSS styles.
>>> Can I somehow control in which order those stylesheets are loaded? How?
>>>
>>>
>>> Thanks in advance :-)
>>> Beat
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Define stylesheet import order

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 20 Mar 2012 10:52:11 -0300, Beat Durrer <bd...@gmail.com> wrote:

> Thanks for your help Lance, I'm sure it could work that way.
>
> I am a bit suprised that there is no direct solution to this. It's
> common to have some libraries or default CSS and override them on
> specific pages / layouts.

Tapestry already does that, but it seems you have spotted a corner case  
which isn't covered.

>>> I have a "RootLayout" component which loads a CSS file, and some
>>> SubLayout components add an other CSS.
>>> I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
>>> the Layout classes.

What is inside what?

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

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


Re: Define stylesheet import order

Posted by Beat Durrer <bd...@gmail.com>.
Thanks for your help Lance, I'm sure it could work that way.

I am a bit suprised that there is no direct solution to this. It's
common to have some libraries or default CSS and override them on
specific pages / layouts.
Making CSS special cases or writing an own MarkupRendererFilter for an
issue that could be solved by placing the CSS links in the correct
order seems like a big overkill to me.

I rather go back to writing the CSS include myself than jumping through hoops.




2012/3/19 Lance Java <la...@googlemail.com>:
> In your AppModule, you can contribute a MarkupRendererFilter to fire after
> JavaScriptSupport
>
>    public void
> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
> configuration) {
>        configuration.addInstance("MyMarkupRendererFilter",
> MyMarkupRendererFilter.class, "after:JavaScriptSupport");
>    }
>
> MyMarkupRendererFilter can use then manipulate the MarkupWriter's DOM
> before it is written to the response output stream
>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/MarkupWriter.html
>
> On Monday, 19 March 2012, Beat Durrer <bd...@gmail.com> wrote:
>> Hi all,
>>
>> I have a "RootLayout" component which loads a CSS file, and some
>> SubLayout components add an other CSS.
>> I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
>> the Layout classes.
>>
>> At the moment, the CSS from RootLayout is loaded after the SubLayouts
>> and therefore overrides theCSS styles.
>> Can I somehow control in which order those stylesheets are loaded? How?
>>
>>
>> Thanks in advance :-)
>> Beat
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>

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


Re: Define stylesheet import order

Posted by Lance Java <la...@googlemail.com>.
In your AppModule, you can contribute a MarkupRendererFilter to fire after
JavaScriptSupport

    public void
contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
configuration) {
        configuration.addInstance("MyMarkupRendererFilter",
MyMarkupRendererFilter.class, "after:JavaScriptSupport");
    }

MyMarkupRendererFilter can use then manipulate the MarkupWriter's DOM
before it is written to the response output stream

http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/MarkupWriter.html

On Monday, 19 March 2012, Beat Durrer <bd...@gmail.com> wrote:
> Hi all,
>
> I have a "RootLayout" component which loads a CSS file, and some
> SubLayout components add an other CSS.
> I'm using T5.3.2 and simply applied the @Import(stylesheet={...}) to
> the Layout classes.
>
> At the moment, the CSS from RootLayout is loaded after the SubLayouts
> and therefore overrides theCSS styles.
> Can I somehow control in which order those stylesheets are loaded? How?
>
>
> Thanks in advance :-)
> Beat
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>