What does currentDesign.writeCssincludes include?

I am trying to find out what exactly css is enabled by the standard call currentDesign.writeCssIncludes(pagecontext); found in headlibs.jsp. The documentation states that this

 Convenience method that writes the CSS include strings to the response. 

Looking at what it does, it will include /etc/designs/currentdesign.css , which is built from css design components and /etc/designs/currentdesign/static.css , which is just a static file. But will it be all that will be?

In particular, what I would like to do is include a clientLib processed css file as part of my design. One way to do this is to manually create css:

 <link rel="stylesheet" href="<%= currentDesign.getPath() %>/myclientlib.css" /> 

But I would prefer it to be created automatically, so my designers have the flexibility to structure css files differently for different projects (i.e. for a โ€œbasicโ€ design, they are only good with the static.css file but for the โ€œfancyโ€ one design they want to use LESS css and split files in more detail). And it would be useful to put design-specific css information with the components that they affect, and then separate them.

+6
source share
2 answers

You can use the <cq:includeClientLib> in combination with themes and / or categories to mix and match CSS bits.

But you may find that this is somewhat limiting; for example, you cannot specify a media attribute. If you need to do this, or your designers do not structure their CSS in a way that suits the theme / category model, your reserve is the method that you defined in your question using <link> directly.

Update

Great question about topics! I just saw how they were used along the way.

You can define a theme by simply adding a new folder / node under /etc/designs/yourproject/clientlibs/themes , as a brother to default .

You can pull out client sheets for a topic with the <cq:includeClientLibs> , possibly under the control of some conditional logic. For example, in one of my projects, I have a topic called authoring that I want to apply only to the authorโ€™s instance; I embed it with this code in headlibs.jsp :

 <c:if test="${ (global['wcmmode'] eq 'EDIT') || (global['wcmmode'] eq 'PREVIEW') }"> <cq:includeClientLib theme="apps.myproject.authoring" /> </c:if> 

I have not seen any documentation that would automatically apply a theme to a separate subtree of the content tree or based on the presence of a tag.

There is such a critical operator: "The topic name is retrieved from the request." in Adobe docs backed up by this statement in Sling docs , ThemeResolverFilter provides a subject for the request. The theme is provided as a request attribute. "Therefore, perhaps binding &theme=apps.yourproject.foo to the query string would apply this theme.

+2
source

The list of CSS files is based on the cq: designPath property of the page.

0
source

All Articles