1. dautrich
  2. Sherlock Holmes The Voice
  3. Commercial Templates
  4. Monday, 15 May 2023
  5.  Subscribe via email
Hi Ciaran

I have a new project: I build a new website with exactly the same look as an existing one (new business, same owner). Therefore, I set up a new website with Joomla 4.3.1 and SKYLAR_J4. I exported the preset from the old site (still J3, because it will be shut down before August 2023) and imported it into my new site - worked like a charm. I copied the custom.css from the old site and FTPed it to the new site at the well-known place /templates/j51_skylar/css/custom.css. What happened: Absolutely nothing! My custom CSS was not used.

I suspected an error on my site. So I uninstalled SKYLAR and re-installed it. Same result. After some hours of searching, I made a test: I FTPed my custom.css to the /media/templates/site/j51_skylar/css folder. This worked immediately. Subsequently, I deleted the file from /templates/j51_skylar/css (I hate to have the same file in two different places. Inconsistent file contents in the future are highly probable!).

Everything fine then? Not quite:

  1. Although the /templates/j51_skylar/css/custom.css has no effect, the template seems to expect it to be there. If the file doesn't exist, my Firefox console shows errors (s. J51_Skylar_J4_V1.1.8_Issue_with_custom.css.jpg), which shouldn't be there.

  2. J51_Skylar_J4_V1.1.8_Issue_with_custom.css.jpg


  3. Sites which have been updated from older J4 versions still expect the custom.css at the old place. This is not documented and might drive webmasters crazy.

As a temporary solution, I have inserted a dummy custom.css to the old place /templates/j51_skylar/css:
/*    Dummy for custom.css     
For websites started prior to Joomla 4.3.x, this is the place to put the custom.css file.
For websites started with Joomla 4.3.x or later, the custom.css file has to be placed in
the /media/templates/site/j51_skylar/css folder.
*/


Regards

Rolf
Attachments (1)
References
  1. https://dev.lebenswert-neudorf.de/
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Rolf

Thank you for sharing your solution. It is clear that we need to find a better solution to handle this. From where Joomla loads extension assets can be a bit confusing and can depend on a number of different factors (eg. Joomla version, child templates etc.) It might be best for us to create an option to set the asset source, overriding Joomla with a setting in the template style options. What do you think?

Ciaran
  1. more than a month ago
  2. Commercial Templates
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Ciaran

Even that may be a little bit tricky. What about existing installations on template or Joomla updates? Can you check for existing custom.css in the two (or more?) possible locations? Can you copy an existing custom.css to the "old" location and force using it? What happens, if a custom.css sits in both locations?

I'm not sure whether you can figure out all possible variants. Maybe it's better to give clear advice in a tutorial what the webmaster should do. Similar to what I wrote in my post.

Rolf
  1. more than a month ago
  2. Commercial Templates
  3. # 2
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Ciaran

I plan to report this as a bug against J4.3. If I have done that, I will edit this post to include the issue number here.

Rolf

Update:
I will not report a bug against J4.3 for the moment. Maybe it would be better to follow your idea of offering one (or more) template options for the location of custom.css.
  1. more than a month ago
  2. Commercial Templates
  3. # 3
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Ciaran

I have investigated a little bit further:

I installed a site (updated.rolfdautrich.de) using Joomla 4.0.6. For Cassiopeia, I built a very basic user.css (body background in yellow) and copied it to /templates/cassiopeia/css (s. updated_J4.0.6_Cassiopeia_User.css.jpg).

updated_J4.0.6_Cassiopeia_User.css.jpg

In frontend, I checked whether the CSS was used (s. updated_J4.0.6_Cassiopeia_Frontend.jpg).

updated_J4.0.6_Cassiopeia_Frontend.jpg

I also installed Skylar_J4 with a similarly simple custom.css in /templates/j51_skylar/css (s. updated_J4.0.6_SKYLAR_custom.css.jpg), and checked in frontend (s. updated_J4.0.6_SKYLAR_Frontend.jpg).

updated_J4.0.6_SKYLAR_custom.css.jpg

updated_J4.0.6_SKYLAR_Frontend.jpg

Afterward, I updated the site to the current Joomla 4.3.2.

Analysis of Cassiopeia's template files revealed that during the update process, the user.css was moved to /media/templates/site/cassiopeia/css (s. updated_J4.3.2_Cassiopeia_User.css.jpg).

updated_J4.3.2_Cassiopeia_User.css.jpg

On contrary, the custom.css in Skylar's template files remained in its previous place. Therefore, it was not used anymore: in frontend, the background didn't show any yellow. Only after moving it into the /media directory structure, it was used.

Remark: I did not encounter a 404 error, if there was no custom.css in the /template directory structure.

What I didn't test: Since I updated directly from 4.0.6 to 4.3.2, I don't know which update made the switch from the /template structure to the /media structure.

Later, I installed another site with the most recent Joomla version. It showed that the behavior of the site was identical to an updated site. user.css or custom.css must be placed in the /media directory structure to be used.

Regards

Rolf
Attachments (5)
  1. more than a month ago
  2. Commercial Templates
  3. # 4
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Rolf

My apologies for putting this topic on a very long finger. :/

Considering your detailed analysis of this topic, I believe the best option is to include a second with the option to enable the loading of a custom.css. This option will allow you to select between the following...

1. Default - Let Joomla decide on where to load template assets (current)
2. Template - Load the custom.css from the template folder (regardless of Joomla 4 version)
3. Media - Load the custom.css from the media folder (regardless of Joomla 4 version)
4. URL - Load from a URL of the users choice

Do you think this will cover all scenarios? If you believe so, then I will add the change to the Skylar template as a POC.

Ciaran
  1. more than a month ago
  2. Commercial Templates
  3. # 5
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Ciaran

This sounds like a solid solution. You might add some inline comments on typical scenarios:

  • - Template: Typically correct for sites updated from "early" Joomla 4 versions.
  • - Media: Typically correct for sites created from 4.3 (?) or later.


Regards

Rolf
  1. more than a month ago
  2. Commercial Templates
  3. # 6
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Rolf

I have created a new update of our Skylar template with the feature added. I will document with a further update. A few further options that might help...

- Allow the naming of the CSS file (eg. mycustom.css?
- Allow the addition of multiple files?

Ciaran
  1. more than a month ago
  2. Commercial Templates
  3. # 7
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Ciaran

I've downloaded V1.1.10 of Skylar_J4 and will test it starting tomorrow. Pls be aware that this download still incorporates the old version Call-to-Action 1.0.0.

About your ideas for potential further options:

  • I've not seen many templates up to now, but all of those use either user.css or custom.css.
  • It has always been obvious to me: If I use a template from Joomla51, I have to use custom.css.
  • I don't see any added value in offering the option to use a different name for the CSS file.
  • Allowing multiple files leads to an additional level of complexity. IMHO this only makes things more complicated: In which of my CSS files did I change the appearance of the login form? In which sequence will my CSS files get applied? ....


In short: I don't think that those options would really add value to your templates.

Rolf
  1. more than a month ago
  2. Commercial Templates
  3. # 8
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Ciaran

I have done some testing today. Here are my results:

Test_Planning_Skylar_J4_V1.1.10.jpg

I got the impression that there has been some change in behavior between Joomla 4.3.1 (which I used, when I posted in your forum) and 4.3.3 (which I used for today's tests).

The tests revealed positive results. IMHO, you can use your approach for your templates. However, in my opinion you should use "Default" for the button instead of "Asset Manager".

Rolf


Update: I also installed the new template version on one of my "real" sites (as opposed to the test sites mentioned above). This is an old site, migrated from J2.5 to J3 and finally to J4. Here, the default (or "Asset Manager" ) setting was wrong. I had to use the "Template" setting instead. This worked as expected.
Attachments (1)
  1. more than a month ago
  2. Commercial Templates
  3. # 9
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Rolf

Thank you for your detailed analysis and suggestions. It is very much appreciated.

I have just created a new update to the Skylar amending the button label from 'Asset Manager' to 'Default' as per your suggestion. Your points on adding options for naming and multiple sources are valid so for now I will leave it as is. In time I will apply this feature to all templates that allow the loading of a custom CSS file.

Ciaran
  1. more than a month ago
  2. Commercial Templates
  3. # 10
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!

Join Our Newsletter

* indicates required
We respect your privacy and do not tolerate spam and will never sell, rent, lease or give away your information (name, email, number, etc.) to any third party. Nor will we send you unsolicited email.
Joomla51 - Mullaghmore, Co. Sligo, Ireland
Joomla51.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by
Open Source Matters
the trademark holder in the United States and other countries.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.

Ok