I have a module in which I would like to add a stylesheet and a script. I am creating a lot of modules for this project, and I would like to use a centralized json file for my scripts and styles, since a lot of them are used here and there.
$wa = Factory::getDocument()->getWebAssetManager();
$wr = $wa->getRegistry();
$wr->addRegistryFile(JPATH_SITE.'/media/com_foo/joomla.asset.json');
$wa->useStyle('com_foo.foo');
$wa->useScript('com_foo.fooscript');
My current code throws the following:
There is no "com_foo.foo" asset of a "style" type in the registry.
Shouldn't this be possible? Am I doing it wrong?