Foros de discusión

Where to add additional CSS to a hook?

thumbnail
Brandt Solovij, modificado hace 11 años.

Where to add additional CSS to a hook?

New Member Mensajes: 14 Fecha de incorporación: 23/03/12 Mensajes recientes
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
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Where to add additional CSS to a hook?

Liferay Legend Mensajes: 14915 Fecha de incorporación: 2/09/06 Mensajes recientes
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.
thumbnail
Brandt Solovij, modificado hace 11 años.

RE: Where to add additional CSS to a hook?

New Member Mensajes: 14 Fecha de incorporación: 23/03/12 Mensajes recientes
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
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Where to add additional CSS to a hook?

Liferay Legend Mensajes: 14915 Fecha de incorporación: 2/09/06 Mensajes recientes
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.
thumbnail
Brandt Solovij, modificado hace 11 años.

RE: Where to add additional CSS to a hook?

New Member Mensajes: 14 Fecha de incorporación: 23/03/12 Mensajes recientes
Ok fair enough - I'll approach it from the theme level

-b
thumbnail
Brandt Solovij, modificado hace 11 años.

RE: Where to add additional CSS to a hook?

New Member Mensajes: 14 Fecha de incorporación: 23/03/12 Mensajes recientes
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!
thumbnail
Fernando Fernandez, modificado hace 9 años.

RE: Where to add additional CSS to a hook?

Expert Mensajes: 396 Fecha de incorporación: 22/08/07 Mensajes recientes
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.