Sean
Sean

Reputation: 313

Liferay CSS @import Issue

I tried to take a look around here and on the Liferay forums but I couldn't find a documented solution to my issue.

I am currently using Liferay 6.2 and am very new to the environment. My issue arises from CSS @import functions. Our architecture is one main stylesheet with all supporting stylesheets imported into this document. Those CSS documents in the same directory present no issue - for example @import url(document.css);. We do have a master stylesheet located in another portlet and all other portlets reference this stylesheet with an import call similar to @import url(../../../../folder/folder/document.css);. When using this command, the CSS in this file isn't imported into the portlet. If I place the master stylesheet in the same directory as the CSS for that portlet and adjust the import path accordingly, the stylesheet is imported without any issues. I can also place it one directory up such as @import url(../folder/document.css); and the CSS is imported correctly.

Several team members do not have this issue, while several members do experience this issue - all running the same version of Liferay and on identical machines.

I'm sure my question is fairly vague due to me being new with the environment so if I can clarify or provide any additional details, please let me know!

Upvotes: 0

Views: 180

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48057

If all of the portlets reference the same CSS file they shouldn't: Just assume that the necessary CSS is deployed through the theme and add it to the theme once. This is way more elegant than delivering it multiple times, relying on relative paths to not have changed, and potentially not being available (at runtime, nobody guarantees that an appserver even unzipps your warfiles).

Through enforcing the assumption that you're running in an environment that has proper styling, life will be so much easier.

Upvotes: 0

Related Questions