删除magento中的所有CSS和JS

时间:2022-11-11 03:49:06

I want remove all default magento JS and CSS by page.xml. I have tried to remove by using "removeItem" method, but it takes more effort (nearly 15 to 20 file).

我想通过page.xml删除所有默认的magento JS和CSS。我试图通过使用“removeItem”方法删除,但它需要更多的努力(近15到20个文件)。

Is there are any way to remove only default magento's JS and CSS?

有没有办法只删除默认的magento的JS和CSS?

1 个解决方案

#1


0  

Okay.

If I understand your problem correctly you want to change a parent rather than multiple child files.

如果我正确理解您的问题,您想要更改父文件而不是多个子文件。

Local.xml, that's your key to success. Rather than changing code in the individual files, you're changing a file that tells all the other files to change. Any layout handle can be targeted by any Magento layout file.

Local.xml,这是您成功的关键。您需要更改一个告诉所有其他文件要更改的文件,而不是更改单个文件中的代码。任何Magento布局文件都可以定位任何布局句柄。

Check out your <default> handle, changing the includes would go something like this:

看看你的 句柄,改变包含会是这样的:

<default>
<reference name="head">
    <action method="removeItem">
        <type>skin_js</type>
        <name>js/my_javascript.js</name>
        <params/>
    </action>
    <action method="removeItem">
        <type>skin_css</type>
        <name>css/my_stylesheet.css</name>
    </action>
</reference>

So rather than going into each child file and changing the includes you can simply change the parent file to be a recursive change across the site. This also works in reverse for adding includes by changing removeItem to addItem.

因此,不是进入每个子文件并更改包含,您只需将父文件更改为整个站点的递归更改即可。通过将removeItem更改为addItem,这也适用于添加包含。

I hope this helps!

我希望这有帮助!

Cheers

#1


0  

Okay.

If I understand your problem correctly you want to change a parent rather than multiple child files.

如果我正确理解您的问题,您想要更改父文件而不是多个子文件。

Local.xml, that's your key to success. Rather than changing code in the individual files, you're changing a file that tells all the other files to change. Any layout handle can be targeted by any Magento layout file.

Local.xml,这是您成功的关键。您需要更改一个告诉所有其他文件要更改的文件,而不是更改单个文件中的代码。任何Magento布局文件都可以定位任何布局句柄。

Check out your <default> handle, changing the includes would go something like this:

看看你的 句柄,改变包含会是这样的:

<default>
<reference name="head">
    <action method="removeItem">
        <type>skin_js</type>
        <name>js/my_javascript.js</name>
        <params/>
    </action>
    <action method="removeItem">
        <type>skin_css</type>
        <name>css/my_stylesheet.css</name>
    </action>
</reference>

So rather than going into each child file and changing the includes you can simply change the parent file to be a recursive change across the site. This also works in reverse for adding includes by changing removeItem to addItem.

因此,不是进入每个子文件并更改包含,您只需将父文件更改为整个站点的递归更改即可。通过将removeItem更改为addItem,这也适用于添加包含。

I hope this helps!

我希望这有帮助!

Cheers