Magento 2 Template Overriding – Override HTML Template from Custom Module Not Working

htmlmagento2overridingtemplate

I am trying to override HTML template in my custom module. I am working on Magento ver 2.2.2

Vendor/Moule/view/frontend, I have created a requirejs-config.js file:

    var config = {
    map: {
        '*': {
            'Magento_Checkout/template/minicart/content.html': 'Vendor_Module/template/minicart/content.html',
            'Magento_Checkout/template/minicart/item/default.html': 'Vendor_Module/template/minicart/item/default.html'
        }
    }
};

Copied custom file minicart\content.html to

Vendor\Module\view\frontend\web\template\minicart\content.html and

copied minicart/item/default.html to

Vendor\Module\view\frontend\web\template\minicart\item\default.html

Run below commands:

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

After doing this, my default files disappear and my files are not showing, please let me know if I am doing something wrong.Thanks in advance 🙂

Best Answer

Here is the simple method to show changes of HTML and JS files without clearing the cache of the browser.

Right click on page and inspect element and open network tab. Now Double click on Html or Js file which you edited. And just full refresh html or js page in new tab.

Now Done. You can see changes on next refresh page.

Screenshot:

enter image description here

Related Topic