I have enabled js and css merging and bundling from the configuration.
we can remove particular js or css using below code.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <remove src="name.css"/>
        <remove src="js/name.js"/>
        <remove src="Vendor_Module::js/name.js"/>

But when i try same for removing merged js or css file it is not working, is there any other way to remove that merged css and js files from layout or any other way.

  • So do you want to exclude those files or you trying something else? Apr 8, 2019 at 12:14
  • actually, I want to let merge enabled and want to remove those merged js and CSS file. Apr 8, 2019 at 12:25

2 Answers 2


Exclude js file from the bundle by adding the js file in Theme_Directory/etc/view.xml

<item type="file">Mage_Storelocator::js/googlemap.min.js</item>

Exclude js file from minification in config.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">

You have not excluded the files but you have removed them.

So to exclude the files specified by you from merging/bundling you can add those files to exclude list in your Theme_Directory/etc/view.xml so that they can be loaded individually

    <item type="file">Module_Name::css/name.css</item>
    <item type="file">Module_Name::js/name.js</item>
    <item type="file">Vendor_Module::js/name.js</item>

So if you have minified your files please specify the file name as css/name.min.css or js/name.min.js

enter image description here

I have enabled minification and merge in Magento 2.3.1 and I have excluded this file which is loading separately rather than merge file

<item type="file">Magento_Catalog::js/product/list/toolbar.min.js</item>

You Can Disable Merge Js Or Css Using Admin Backend:-

Js Merge

Store > Configration > Advanced > Developer > JavaScript Settings > Merge JavaScript Files > Set Yes

CSS Merge

Store > Configration > Advanced > Developer > CSS Settings > Merge CSS Files > Set Yes
  • actually, I want to let merge enabled and want to remove those merged js and CSS file. Apr 8, 2019 at 12:25
  • ohk check your js and css file and try to s:up , s:s:d -f and cache clean Apr 8, 2019 at 12:32

Your Answer

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

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