Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Purpose of the static.css file?

Avatar

Employee

Hello,

 

I'm trying to get to know how designs work in CQ5.

I've noticed that if I have CSS files in the clientlibs folder which has a categories property set in a design then I can include these CSS files by calling <cq:includeClientLib categories="category_name" /> in the head.jsp of my page component.

 

Example:

/etc

     /designs

          /demo

               /clientlibs     (categories = "demo")

                    /css

                         /style.css

                    /css.txt

 

Now if I copy the design and change some CSS settings then both clientlibs folders are included, because both have "demo" as the value of the categories property.

 

Generated HTML-code:

<link rel="stylesheet" href="/etc/designs/demo 2/clientlibs.css" type="text/css">

<link rel="stylesheet" href="/etc/designs/demo/clientlibs.css" type="text/css">

 

This is a problem if I want a website where the author can choose a design over the page properties.

While examining the Geometrixx project I noticed that "static.css" is being used for designs.

Unfortunately I was not able to find a description about what purpose "static.css" is supposed to have in CQ5.


What I would like to know:

What's the puprose of static.css?

Is the static.css file used in CQ5 for other things than just page styling?

Are there any 'best practices' I should look into?

1 Accepted Solution

Avatar

Correct answer by
Employee

Here's a small update for those who want to keep their CSS files in the 'clientlibs' folder:

 

If there are different designes available for a website, then you can use the design's name as the 'categories' value and in your head.jsp retrieve the current design and use the name (ID) in the <cq:includeClientLib > line.

 

Code:

<cq:includeClientLib categories="<%= currentDesign.getId() %>" />

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

Here's a small update for those who want to keep their CSS files in the 'clientlibs' folder:

 

If there are different designes available for a website, then you can use the design's name as the 'categories' value and in your head.jsp retrieve the current design and use the name (ID) in the <cq:includeClientLib > line.

 

Code:

<cq:includeClientLib categories="<%= currentDesign.getId() %>" />