theme is overriden by default css

UI Components for JSF
Locked
tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

08 Sep 2011, 19:38

use:

<h:head>

<f:facet name="last">
your stylesheet
</f:facet>
</h:head>
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

pavaros
Posts: 73
Joined: 22 Jun 2010, 17:45
Location: Netherlands
Contact:

08 Sep 2011, 20:56

zoigl, thanks for your response. But that changes only the order of the styles imported in the <h:head> section. The component styles from the primefaces.jar still come last and keep overriding all other styles. So that doesn't help, sorry.
Paul.
JSF 2.2.3, Primefaces 4.0, Tomcat-7.0.40

king6887
Posts: 29
Joined: 11 Jul 2011, 12:04

13 Sep 2011, 10:57

I'm having an issue with this also, just happened to notice it on the buttons example as someone mentioned earlier in the thread.

current order: theme.css, component.css, scripts.js, other_included_in_head.css

order i believe it should be: component.css, theme.css, other_included_in_head.css, scripts.js

That way themes always override the default component styles, individual stylesheets override themes (maybe for certain pages you want to make tweaks etc), and then the scripts load after all the CSS (faster page loading, best practice etc..)

I'd rather like to avoid having to include another stylesheet as per the OP's solution, as that pretty much defeats the entire point of a theme in the first place.

Thanks in advance for any feedback.
Running PrimeFaces 3.0.M2 / 3.0.M4 using Mojarra-2.1.3 on Glassfish 3.1.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

13 Sep 2011, 11:13


king6887
Posts: 29
Joined: 11 Jul 2011, 12:04

13 Sep 2011, 11:32

optimus.prime wrote:RC1 has;

http://blog.primefaces.org/?p=1433
While that is a nice addition, that still doesn't help with the theme and component css order. Since both are PF defined.

Edit, just thought of a better way to describe the various layers.

Component.css - Default styles that are 'read-only' within the primefaces jar (technically its changeable but i doubt people want to build from source every time a new version is out etc..)
Theme.css - The first level of customisation
Head_include.css - The second level of customisation

Since the components default css can be taken as read-only, it doesn't make any sense for it to come after the theme.css. Why override customisation with default values, it defeats the entire point doesn't it?
Running PrimeFaces 3.0.M2 / 3.0.M4 using Mojarra-2.1.3 on Glassfish 3.1.1

king6887
Posts: 29
Joined: 11 Jul 2011, 12:04

14 Sep 2011, 10:33

issue added to the issue tracker for this.

http://code.google.com/p/primefaces/iss ... il?id=2505
Running PrimeFaces 3.0.M2 / 3.0.M4 using Mojarra-2.1.3 on Glassfish 3.1.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

14 Sep 2011, 11:13

It seems everyone wants a different resource ordering.

We will keep current order which works fine for us. Use last facet with link tag.

king6887
Posts: 29
Joined: 11 Jul 2011, 12:04

14 Sep 2011, 11:22

I honestly can't see any valid reason for it to be any other way other than what i have listed here. There is no valid scenario where you'd want default styles overriding a theme style, that makes the theme an entirely pointless concept and all css would have to be included in a stylesheet, linked manually using "facet last".

If someone can point out when this would ever be wanted then i'll take a look at it, but, logically, the current order is just stupid.

current process:

1) write a theme and apply it
2) realise half the changes you made are over written by default values
3) create a seperate stylesheet with the content that is overriden in theme.css and include it manually in the page header / or add a link to theme.css again, loading it twice.

my suggested process:

1) write theme and apply it.

Any other manually included stylesheets would be applied after the above.


Honestly which makes more sense?
Running PrimeFaces 3.0.M2 / 3.0.M4 using Mojarra-2.1.3 on Glassfish 3.1.1

ltune
Posts: 125
Joined: 20 Jul 2011, 20:25
Contact:

14 Sep 2011, 11:37

Well.

as far as I know all themes by Primefaces are free to reuse.

I liked the rocket-theme, howerver the font-size was annoying, therefore I created small-rocket [1], which is exact copy of rocket, but font-size 10px and 12px.

I imagine you could just open the style you like, change the pom not to conflict with the primefaces names and there you are.

OK.. I have to admit you run in to things like hosting your own repositories and a bit of maven coding.

Personally, for me it was the more elegant way, than to override the theme by another css file.

Greets,

Adam

[1] http://ltune.de/de/ltune/dev/smallrocket/1.0-SNAPSHOT/
Busy applying primefaces patches to my local repo at /dev/null

king6887
Posts: 29
Joined: 11 Jul 2011, 12:04

14 Sep 2011, 11:43

ltune wrote:Well.

as far as I know all themes by Primefaces are free to reuse.

I liked the rocket-theme, howerver the font-size was annoying, therefore I created small-rocket [1], which is exact copy of rocket, but font-size 10px and 12px.

I imagine you could just open the style you like, change the pom not to conflict with the primefaces names and there you are.

OK.. I have to admit you run in to things like hosting your own repositories and a bit of maven coding.

Personally, for me it was the more elegant way, than to override the theme by another css file.

Greets,

Adam

[1] http://ltune.de/de/ltune/dev/smallrocket/1.0-SNAPSHOT/
The theme i'm talking about is a custom theme entirely. It's not an issue with wanting to override theme.css with custom included css. It's the fact the theme.css is getting overridden by the css included in primefaces.jar (button.css etc...)
Running PrimeFaces 3.0.M2 / 3.0.M4 using Mojarra-2.1.3 on Glassfish 3.1.1

Locked

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests