So What Is Joomla 4 Web Asset Manager?

If you reading this you know what Joomla is? Joomla is popular content management system (CMS) that allows users to create websites without requiring knowledge of HTML or CSS. However since it has been a while since we published here anything related to Joomla®, or anything at all we thought we shed some light on Joomla Web Asset Manager (no, I don’t mean game assets, like these for game development or 3D scenes).  Similarly to WordPress Joomla evolved and went long way (Joomla 4.2.x), at least since we released The Flow and Pure2 website templates for this CMS.  Let’s stay on track…

What is Joomla Web Asset Manager?

Joomla Web Asset Manager is a tool that helps developers manage assets such as CSS and JavaScript files in Joomla websites. This tool allows developers to avoid conflicts and ensure that assets are loaded in the correct order.

Simple yet Powerful Tool

Joomla® Web Asset Manager is a powerful tool for managing assets in Joomla® websites. Assets are defined in a JSON file, such as system/joomla.asset.json. This JSON file has a structure that includes a schema definition (for validation), name, version, license, and one or more asset definitions. Assets are comprised of a list of JS files and CSS. Below in this answer, we will explore some examples of how to use it.

How to Call Web Assets Manager

To call an asset using the Web Asset Manager in your Joomla template, you can use the following code in the index.php file of your template package:

$wa = $this->getWebAssetManager ();
$wa->enableAsset ('template.cassiopeia.ltr');

As you can see for the sake of simplicity we use example Joomla’s newest Cassiopeia theme or template  if you stick to proper naming conventions.

How Does Joomla® Web Asset Manager work?

This code calls assets in the following order: dependencies and files from the “template.cassiopeia.base” asset. Joomla Web Asset Manager ensures that these assets are not loaded twice if two extensions include the same file, and that they are loaded in the correct order.

End Note

In conclusion, Joomla Web Asset Manager is a powerful tool for managing assets in Joomla websites. By using a JSON file to define assets and ensuring that assets are loaded in the correct order, this tool helps prevent conflicts and ensures that website pages load quickly and smoothly. With Joomla being one of the most popular CMSs in the world, it is a crucial tool for developers looking to optimize the performance of their Joomla websites.

As you may have guessed we are looking closer into development of some good Joomla website templates. Saying that this is only small hint as for now we are busy with WordPress themes.

No Comments Yet.

Leave a comment