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

zsi*_*tro 27 css layout add magento

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

<reference name="head">
    <action method="addCss"><stylesheet>css/local.css</stylesheet></action>
</reference>
Run Code Online (Sandbox Code Playgroud)

这到同一个文件里面:

<action method="removeItem"><type>css</type><name>css/local.css</name></action>
Run Code Online (Sandbox Code Playgroud)

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

Sha*_*bob 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>
Run Code Online (Sandbox Code Playgroud)

  • 超越OP问题的好工作可以帮助Google员工. (3认同)
  • 谢谢@Benjam!Magento非常困难,部分答案并没有多大帮助. (2认同)

Jos*_*osh 42

试试skin_css:

<action method="removeItem"><type>skin_css</type><name>css/local.css</name></action>
Run Code Online (Sandbox Code Playgroud)