留言板

CSS in Liferay

thumbnail
Roman Hoyenko,修改在12 年前。

CSS in Liferay

Liferay Master 帖子: 878 加入日期: 07-10-8 最近的帖子
Is there a way to have a separate CSS defined per page or per community in Liferay?

I want users to be able to define some of their own css without using Advanced Styles of the portlet - using Advanced Styles makes the management of CSS files pretty complex, if something changes we need to update several places.
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: CSS in Liferay

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Page and community information is stored in the database so I think you'll have to use Advanced Style.

The other option, which is not very desirable, is to hard code css into the template with a selection criteria
for page and community.
thumbnail
Samuel Kong,修改在12 年前。

RE: CSS in Liferay

Liferay Legend 帖子: 1902 加入日期: 08-3-10 最近的帖子
1. Dockbar > Manage > Page
2. Find the "Look and Feel" (there's two. One for the whole community and one for just the current page)
3. Look and Feel > Regular Browsers > CSS

This is similar to the Advance Style of the portlet, but the CSS is attached to the community/page instead of a portlet.
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: CSS in Liferay

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Thanks Samuel, didn't know about that feature. Seems I still have more things to learn about Liferay.emoticon
thumbnail
Roman Hoyenko,修改在12 年前。

RE: CSS in Liferay

Liferay Master 帖子: 878 加入日期: 07-10-8 最近的帖子
Thanks, that would help us a lot!
thumbnail
Roman Hoyenko,修改在12 年前。

RE: CSS in Liferay

Liferay Master 帖子: 878 加入日期: 07-10-8 最近的帖子
Ok, I tried it and it looks like when I have more or less complex rules like

.link-box ul li {
vertical-align:top;
}

it says:

You have entered invalid data. Please try again. Can we avoid the check? Looks like this is a bug.
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: CSS in Liferay

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
I was able to save it without any problem on 6.0.6 Tomcat bundle.
thumbnail
Roman Hoyenko,修改在12 年前。

RE: CSS in Liferay

Liferay Master 帖子: 878 加入日期: 07-10-8 最近的帖子
may be it's the size of the css, I'll check and post my findings
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: CSS in Liferay

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
I think it was LONGVARCHAR. So the max size is around 32K.
thumbnail
Roman Hoyenko,修改在12 年前。

RE: CSS in Liferay

Liferay Master 帖子: 878 加入日期: 07-10-8 最近的帖子
Do you know the table it is stored in? May be I can change it to CLOB so the size is not limited.

But I don't think our CSS was even 32k, most likely it's 4000 bytes varchar2. I looked at the Layout table, it has CSS column and it's 4000 bytes, which I think is clearly not enough.

I'll try changing to clob and see if this works.

P.S. Looks like Layout is the table for individual pages and LayoutSet is for the community. They all have 4k limit (at least in Oracle). If the pages are more or less complex 4k is not nearly enough.
thumbnail
Roman Hoyenko,修改在12 年前。

RE: CSS in Liferay

Liferay Master 帖子: 878 加入日期: 07-10-8 最近的帖子
Ok, changing the table from Varchar(4000) to CLOB worked, I can save longer CSS
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: CSS in Liferay

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Wow! Thank you for sharing the information. I'll remember it. emoticon
thumbnail
Samuel Kong,修改在12 年前。

Thread Split

Liferay Legend 帖子: 1902 加入日期: 08-3-10 最近的帖子
Message is slightly off topic, so I'm creating a new thread. The new thread can be found at http://www.liferay.com/community/forums/-/message_boards/view_message/12211457.
thumbnail
Milen Dyankov,修改在12 年前。

RE: CSS in Liferay

Regular Member 帖子: 171 加入日期: 09-9-23 最近的帖子
For community scoped CSS which are themes independent, you may find Custom Global Markup portlet useful. Here is some more info about it: http://milen.commsen.com/2010/04/custom-global-markup-portlet.html