I want to properly remove CSS and JS links from Joomla 4 header

For example I did not want:

<link href="/newer/media/vendor/fontawesome-free/css/fontawesome.min.css?5.15.4" rel="stylesheet" />

To be loaded

  • 1
    The styles and scripts are added using web assets in Joomla 4 so read up on how you can add and remove WebAssets via the template override for that page or via another piece of code. I have tried to help someone a few months ago with removing that same library but we never managed to achieve it as expected so I can't provide the exact answer. Start by reading here docs.joomla.org/Special:MyLanguage/J4.x:Web_Assets
    – Irata
    Jul 10 at 11:10
  • Yes I have already researched before posting, but web assets manager does not have method to remove style that is added from joomla's core.
    – Gocha
    Jul 10 at 11:19
  • Have you considered using something like RegularLabs Re-Replacer to alter the name of the core library to something else so it wont load and your replacement will. A bit of a hack but might be useful for your needs.
    – Irata
    Jul 11 at 1:11
  • Yes there can be found hacks but I need to know correct way to do it. Thanks for your reply.
    – Gocha
    Jul 11 at 6:17
  • 1
    There is no really correct way. WebAsset API simply doesn't support disabling dependencies. You can use hacks like redeclaring the template asset without the FontAwesome dependency.
    – Sharky
    Jul 11 at 6:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.