I'm designing a custom component where I am utilising the tmpl=component ability to render the component only rather than displaying the default template.
How can I remove the unwanted css files which are creating a styling conflict, from the site's head, within the component ?

I use this codes and insert after defined('_JEXEC') or die;

         //get the array containing all the script declarations
     $document = JFactory::getDocument(); 
     $headData = $document->getHeadData();
     $styles = $headData['styles'];

     //remove your script, i.e. mootools

     $headData['styles'] = $styles;

and this code

unset($this->item->_styles[JURI::root(true) . '/administrator/templates/isis/css/template-rtl.css']);

but , these code not work

I want to delete administrator/templates/isis/css/template-rtl.css from custom component source and head.

A Screenshot from custom component source enter image description here


1 Answer 1


You can't. The component is rendered before the template is parsed. You're trying to remove assets which haven't been added yet. You would need a system plugin to remove template stylesheets.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.