论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Brandt Solovij
Where to add additional CSS to a hook?
2013年1月31日 下午4:42
答复

Brandt Solovij

等级: New Member

帖子: 14

加入日期: 2012年3月23日

最近的帖子

Hi all and thanks in advance - essentially my issue is this :


A colleague of mine has configured a portlet to allow a business / power use to select a "mode" of a specific portlet (the hook) . He accomplished this by way of the custom-jsp process via the SDK plugins route.

The hook compile and imports into my liferay (6.1 on remote Tomcat 7) dev environment. Within his custom-jsp is a main.css. He initially added some light styling and has turned it over to me to finalize all the branding. We are approaching the styling of the hook by simply extending nested css statements in the main.css file

the file is found : docroot -> custom_jsps -> html-> portlet-> <portlet type> -> css -> main.css

However on build + subsequent redeploy ( which produce no warnings or errors both ) - the styles are not adhering to elements and the style declarations are not found within the referenced "main.css" (s) found via View Source.

An example of the approach would be :


.result {
display: inline-block;
float: none;
width: 100%;
.custom-result {
color: red;
}
}

Markup related would of course be

<div class="result">
<span class="custom-result"> some result </span>
</div>


Are we missing a step or ? Suggestions / advice / slander all welcome emoticon
David H Nebinger
RE: Where to add additional CSS to a hook?
2013年1月31日 下午7:05
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11285

加入日期: 2006年9月1日

最近的帖子

I'm assuming the hook applies to a Liferay OOTB portlet, because you cannot hook an external portlet.

I believe if you look at the ROOT/html/portlet/<portlet type>/css folder, you'll see your css files. However, you won't see any other files/directories in /ROOT/html/portlet/<portlet type>/ directory if it's not a Liferay portlet.
Brandt Solovij
RE: Where to add additional CSS to a hook?
2013年2月1日 上午8:37
答复

Brandt Solovij

等级: New Member

帖子: 14

加入日期: 2012年3月23日

最近的帖子

David H Nebinger:
I'm assuming the hook applies to a Liferay OOTB portlet, because you cannot hook an external portlet.

I believe if you look at the ROOT/html/portlet/<portlet type>/css folder, you'll see your css files. However, you won't see any other files/directories in /ROOT/html/portlet/<portlet type>/ directory if it's not a Liferay portlet.



Thanks David - I did find some success when i tried this, but i was unsure if it was the correct approach. If you're endorsing it, I'm good with it! Thank you! emoticon
David H Nebinger
RE: Where to add additional CSS to a hook?
2013年2月1日 上午9:25
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11285

加入日期: 2006年9月1日

最近的帖子

Brandt Solovij:
Thanks David - I did find some success when i tried this, but i was unsure if it was the correct approach. If you're endorsing it, I'm good with it! Thank you! emoticon


Wait, I didn't think I was endorsing anything...

What I said was, if you are trying to change a Liferay portlet, then this would work. But if you're trying to change your own portlet, this will not work.

Personally, though, I'd recommend using a theme. Applies CSS across the board, whether for an OOTB portlet or your own portlets.
Brandt Solovij
RE: Where to add additional CSS to a hook?
2013年2月1日 上午11:12
答复

Brandt Solovij

等级: New Member

帖子: 14

加入日期: 2012年3月23日

最近的帖子

Ok fair enough - I'll approach it from the theme level

-b
Brandt Solovij
RE: Where to add additional CSS to a hook?
2013年2月1日 上午11:18
答复

Brandt Solovij

等级: New Member

帖子: 14

加入日期: 2012年3月23日

最近的帖子

Yep - custom.css within the theme picked up and propagated the changes immediately. We were hoping to bundle the component CSS modifications with the hook project ( hooked to the OOTB portlet ) but it looks like that won't be the case. Thanks again for the suggestions and discussion!
Fernando Fernandez
RE: Where to add additional CSS to a hook?
2014年8月1日 上午7:38
答复

Fernando Fernandez

等级: Junior Member

帖子: 56

加入日期: 2007年8月22日

最近的帖子

I was also using custom.css to override some base css but I have this requirement to suport IE9.

Unfortunately, IE9 does not seem to interpret the CSS files coming from Liferay in the same order and so I think sometimes changing the original css witha hook is really necessary.