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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9064604/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:46:41  来源:igfitidea点击:

Magento remove css or js from specific view

cssmagentolayoutadd

提问by zsitro

Hi i added this to catalog.xml layout definition:

嗨,我将此添加到 catalog.xml 布局定义中:

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

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

回答by Shadoweb

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

以下是如何删除皮肤或 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>

回答by Josh

Try skin_css:

试试 skin_css:

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