Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 726
zsitro Avatar asked Jan 30 '12 13:01

zsitro


People also ask

How to remove CSS in Magento 2?

Sometimes, there is a need to remove some CSS and JS from a page as there may be conflictions between the theme and module CSS and JS. In order to remove CSS and JS from a page, <remove> tag is used in layout XML under the <head> tag.

Where do I put custom CSS in Magento?

In the Magento application, the recommended way to include stylesheets is to specify them in layout files. Usually, the stylesheets you include should be available for all store pages. To achieve this, include your CSS in default_head_blocks.


2 Answers

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> 
like image 73
Shadoweb Avatar answered Oct 30 '22 04:10

Shadoweb


Try skin_css:

<action method="removeItem"><type>skin_css</type><name>css/local.css</name></action> 
like image 44
Josh Avatar answered Oct 30 '22 04:10

Josh