exstreme / Jcomments-4

Modified Jcomments 3.0.7 with Recaptcha 2 in comments. Adapted to Joomla 4. No compatibility with Joomla 1.5\2.5\3.x
16 stars 13 forks source link

CSS Template Overrides in 4.0.17? #77

Closed iantrudell closed 2 years ago

iantrudell commented 2 years ago

With the CSS files moving from the tpl folder to media/com_jcomments/css, how do you change CSS on a per-template basis now?

I had a custom template with css in components/tpl//style.css that no longer appears to load in 4.0.17

Globulopolis commented 2 years ago

per-template basis now

What does it mean? Custom component template or custom joomla template? Copy files to new place.

It's a first step to move all component media to media folder to use with webassets manager.

iantrudell commented 2 years ago

per-template basis now

What does it mean? Custom component template or custom joomla template? Copy files to new place.

It's a first step to move all component media to media folder to use with webassets manager.

I used different style.css files depending on which JComments template I was using. They were all located in /components/com_jcomments/tpl//style.css

The issue seems to be the style.css is now hardcoded in /plugins/system/jcomments/jcomments.php:

$document->addStyleSheet(Uri::root(true) . '/media/com_jcomments/css/style.css');

There needs to be a check for whether they are using a custom template, and if so change the path to the custom style.css

https://i.imgur.com/0b7sish.png

https://i.imgur.com/2dZR3Qg.png

Globulopolis commented 2 years ago

@iantrudell as a quick fix just copy css from this folder to media folder.

PS! Web assets manager cannot load assets with dynamic paths. They all hardcoded in json file. It's a long way to move from an old Joomla 1.5 code in component frontend to new Joomla 4 code, where we can use template/layout overrides in ROOT/tempates folder. Not in ROOT/component/ custom template.

Globulopolis commented 2 years ago

CSS now can be located at: ROOT/templates/{joomla_template_name}/html/com_jcomments/{jcomments_template_name}/

and if not found search in

ROOT/media/com_jcomments/css/tmpl/{jcomments_template_name}/

PS! urls to images must be updated in CSS files.