nikosdion / joomla_extensions_development

Joomla Extensions Development: a reference book
GNU Free Documentation License v1.3
11 stars 1 forks source link

In joomla.asset.json the URI requires the prefix of the extension. #21

Closed Irata closed 1 year ago

Irata commented 2 years ago

In the section on Web Assets, https://www.dionysopoulos.me/book/concepts-webassetmanager.html, the examples provided show a uri of the file name only, e.g.

"uri": "backend.min.css",

however I was not able to get my implementation to work using just the file name, I had to add the extension or directory name as such

"uri": "com_emporium/trolleyFunctions.js",

I found that solution in the joomla.asset.json for Akeeba Backup;

            "name": "com_akeebabackup.akeebaui",
            "description": "Common user interface CSS, light mode",
            "type": "style",
            "uri": "com_akeebabackup/akeebaui.css"

I couldn't see anything in the documentation explaining Web Assets that mentioned the prefix is required therefore I am not sure if it is an instance of the examples need updating or an explanation is required in the text body.

nikosdion commented 2 years ago

Yes, the URI is wrong. It should be something like com_foobar/backend.min.css. Joomla expands it to media/com_foobar/css/backend.min.css, the same it's been doing with HTMLHelper::('style', …) since Joomla 1.5.

HermanPeeren commented 1 year ago

Resolved in commit caa00b2a