0

I am trying to remove the css and JS for a specific CMS page but none of the JS or css are being removed. Here is the code that i am using to remove the css and JS

<layout>
    <reference name="head">
        <action method="removeItem"><type>js</type><name>prototype/prototype.js</name></action>
        <action method="removeItem"><type>js</type><name>lib/ccard.js</name></action>
        <action method="removeItem"><type>js</type><name>prototype/validation.js</name></action>
        <action method="removeItem"><type>js</type><name>scriptaculous/builder.js</name></action>
        <action method="removeItem"><type>js</type><name>scriptaculous/effects.js</name></action>
        <action method="removeItem"><type>js</type><name>scriptaculous/dragdrop.js</name></action>
        <action method="removeItem"><type>js</type><name>scriptaculous/controls.js</name></action>
        <action method="removeItem"><type>js</type><name>scriptaculous/slider.js</name></action>
        <action method="removeItem"><type>js</type><name>varien/js.js</name></action>
        <action method="removeItem"><type>js</type><name>varien/form.js</name></action>
        <action method="removeItem"><type>js</type><name>varien/menu.js</name></action>
        <action method="removeItem"><type>js</type><name>mage/translate.js</name></action>
        <action method="removeItem"><type>js</type><name>mage/translate.js</name></action>
        <action method="removeItem"><type>js_css</type><name>ves/jquery/plugins/fancybox/jquery.fancybox.css</name></action>
        <action method="removeItem"><type>js_css</type><name>ves/jquery/plugins/fancybox/jquery.fancybox.css</name></action>
        <action method="removeItem"><type>skin_css</type><name>css/font-awesome.min.css</name><params/></action>
        <action method="removeItem"><type>skin_css</type><name>css/bootstrap/bootstrap-tiny.css</name><params/></action>
        <action method="removeItem"><type>skin_css</type><name>css/custom_theme.css</name><params/></action>
        <action method="removeItem"><type>skin_css</type><name>css/animate.css</name><params/></action>
    </reference>
</layout>

This code is written in layout update xml under Design tab I am attaching image for reference. enter image description here

tab

but none of the JS is CSS is being removed. I tried to debug in code but my remove item is not being called for the files i am calling. So there must be some other way to do this. Please help ! Thank you

2
  • Just confirming, you have cleared all cache after applying these changes, correct? Commented Jun 20, 2018 at 18:09
  • yes cache is disabled already however i have tried clearing cache too it doesnot work Commented Jun 21, 2018 at 4:34

1 Answer 1

0

Remove the layout tags.

<layout><\layout>

I just tested all of these and they worked as expected. I added them to the Layout Update XML section of the CMS page I wanted them removed from, and then cleared the Magento cache.

<reference name="head">
    <!-- For a JS in the js folder -->
    <action method="removeItem"><type>js</type><name>directory/file.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>

Credit to @Shadowbob - https://stackoverflow.com/a/19662670

2
  • Yes i also found that we dont need to use <layout> tag . I had already figured it out but couldnot update here. Thank You for the reply :) Commented Jun 22, 2018 at 12:05
  • @magento noob - now that you say that, I notice it in your screenshot. Didn't even notice that before, glad you were able to sort it out. Commented Jun 22, 2018 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.