Magento从特定视图中删除css或js

时间:2012-01-30 13:27:04

标签: css magento layout add

您好我将此添加到catalog.xml布局定义:

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

并将其放在同一个文件中:

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

但它并没有从该视图中删除css。有可能,它不是正确的标记来实现这一目标。但不知道。任何人都可以帮忙吗?

2 个答案:

答案 0 :(得分:76)

以下是如何删除skin或js文件夹中所有不同的CSS和JS

<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>

答案 1 :(得分:42)

尝试skin_css:

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