Does anyone know how to stop Knockout HTML templates from being cached (for dev purposes)? I don't have this issue with any other files (CSS, PHTML, XML, JS), it only happens with HTML templates.
As an example I will add the word test to the checkout button in the minicart. The file already exists, the only change I'm making is to add the word test.
<!-- ko i18n: 'Go to Checkout TEST' --><!-- /ko -->
File: app/design/frontend/VENDOR/THEME/Magento_Checkout/web/template/minicart/content.html
These are the steps I usually have to take to display my changes:
- Clear Magento cache (
php bin/magento c:f
) - Clear browser cache
- Refresh
No change.
- Clear browser cache again
- Refresh
The change is now visible. This time I got lucky, sometimes it requires more cache clears and other times I give up and delete the caches, var/view_preprocessed
and pub/static/frontend
.
My questions are:
What causes this?
Why does it only affect HTML files?
Is there a workaround?