Overriding CSS and JS
In Joomla!, all the style sheets and JS files should be managed through the Web Assets Manager. We introduced Joomla’s Web Assets Manager in Chapter 3, Developing the Frontend of a Basic Joomla! Component. This offers great flexibility, as we can use Web Assets Manager methods to enable, disable, or override our CSS and JS.
Overriding assets with the Web Assets Manager
When creating a template override, we modify the look and feel of a specific page, and we may need to use a different version of a JS library or replace a CSS file completely.
In those cases, the Web Assets Manager is of great help, as it allows us to replace assets in our template overrides easily. Let’s see an example, replacing the jQuery library that Joomla! uses with a different version.
Add the following lines to the /templates/cassiopeia/html/com_spm/alternative.php
override, just after declaring your namespaces:
$wam = Factory::getApplication()->getDocument...