Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1948

Templates for Joomla! 5.x • Re: css & js in custom template not working:

$
0
0
After installing the template, string(15) "Adding CSS file" is shown at the top of the document. However, the css still doesn't work (I also tried clearing the cache again)
Hi. You should use Web Asset Manager ($wa). This is how it should look like in index.php

2.jpg

Tip: Use Cassiopea's index.php like example
Thank you for the suggestion. So in my template, I added a joomla.asset.json file. In that file, I added this code:

Code:

{  "$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",  "name": "Gardentemplate",  "version": "4.0.0",  "description": "This file contains assets used by gardentemplate",  "license": "GPL-2.0-or-later",  "assets": [    {      "name": "mystyle",      "type": "style",      "uri": "style.css"    }  ]}
The css file is located in css/style.css of my template folder.

Then, in index.php, I added this:

Code:

<?php$wa  = $this->getWebAssetManager();$wa->useStyle('mystyle');?>
From what I read up on, this should work, but it doesn't. What am I missing?

Statistics: Posted by SocketPup — Wed Mar 20, 2024 9:14 am



Viewing all articles
Browse latest Browse all 1948

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>