zsitro
zsitro

Reputation: 1892

Magento remove css or js from specific view

Hi i added this to catalog.xml layout definition:

<reference name="head">
    <action method="addCss"><stylesheet>css/local.css</stylesheet></action>
</reference>

and this to inside the same file:

<action method="removeItem"><type>css</type><name>css/local.css</name></action>

But it doesn't remove the css from that view. It is possible, that its not the right markup to achieve this. But have no idea. Anyone can help out?

Upvotes: 27

Views: 35897

Answers (2)

Shadoweb
Shadoweb

Reputation: 6306

Here is how to remove all the different CSS and JS in skin or js folder

<reference name="head">
    <!-- For a JS in the js folder -->
    <action method="removeItem"><type>js</type><name>functions.js</name></action>
    <!-- For a JS in the skin folder -->
    <action method="removeItem"><type>skin_js</type><name>functions.js</name></action>
    <!-- For CSS in the skin folder -->
    <action method="removeItem"><type>skin_css</type><name>css/local.css</name></action>
    <!-- For CSS in the js folder -->
    <action method="removeItem"><type>js_css</type><name>local.css</name></action>
</reference>

Upvotes: 77

Josh
Josh

Reputation: 2820

Try skin_css:

<action method="removeItem"><type>skin_css</type><name>css/local.css</name></action>

Upvotes: 42

Related Questions