theme is overriden by default css

UI Components for JSF
Locked
king6887
Posts: 29
Joined: 11 Jul 2011, 12:04

14 Sep 2011, 16:38

optimus.prime wrote:If we render theme after registered css, then we'll break apps that overrides theme visuals by using h:outputStylesheet as a resource registered with h:outputStylesheet will be rendered before theme so people can't override the themes if they are keeping their extensions in a separate css file like myapp.css. This will also break our apps as well since we've used this approach to override themes instead of changing theme.css file.

theme.css file is ideally should contain theme stuff not the structural stuff then. Order is;

- theme.css
- appcssthathasoverrides.css

Which makes sense to me.
come to think of it, this wouldn't work either.

because if you use h:outputstylesheet it results in the following:

- theme.css
- appcssthathasoverrides.css
- structural-primefaces.css
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, 16:40

You can still use !important to merge structural css and theme css in same css file. There is no restriction, css is flexible.

http://www.w3schools.com/css/

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

14 Sep 2011, 16:43

If you use h:outputStylesheet, depending on where you place your outputstylesheet, rendered location will change;

- In h:head -> before pf-jsf.css
- After h:body close -> after pf.jsf.css

So the best way to think simple and use link tag in h:head directly instead of outputStylesheet for overrides as it is placed after theme and pf-jsf css.

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

14 Sep 2011, 16:45

As I said in my previous post, it doesn't work like that everytime, it depends on whereever you place your h:outputStylesheet. e.g. Before </h:body> renders it after pf-jsf.css and theme.css although all css ends up in <head />

Got it?

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

14 Sep 2011, 16:56

right, so if i include theme.css AGAIN at the end of my page template it will appear below the pf-jsf css?

So i have to use the stylesheet twice in order for it to work correctly. OK makes sense o_O
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, 17:01

It seems you can't get it. I'm stepping out from this topic. But this was a good post to document what to do.

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

14 Sep 2011, 17:03

I'm not the one that doesn't get it, i think you are the one that doesn't understand how css actually works. Which is why the order that the stylesheets are called in is so wrong.

so i've added <h:outputStylesheet name="theme.css" library="primefaces-CustomTheme"/> to the end of my page template, and it works as expected now... Doesn't change the fact you have to call theme.css twice for it be rendered int he correct location, that is a pretty serious fault.
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, 17:04

I think you are a bit angry.

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

14 Sep 2011, 17:06

Have you read the link I posted or read any of my posts.

http://www.w3.org/Style/CSS/

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

14 Sep 2011, 17:11

Code: Select all

so i've added <h:outputStylesheet name="theme.css" library="primefaces-CustomTheme"/> to the end of my page template, and it works as expected now... Doesn't change the fact you have to call theme.css twice for it be rendered int he correct location, that is a pretty serious fault.
Well it is your serious fault because you are adding it twice to your page instead of following best practices.

Locked

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests