Magento 2.1 – Override Knockout HTML Template in Theme

htmlknockoutjslayoutmagento-2.1magento2.1.5

I need to add a class to the cart summary table caption.

I want to hide the caption by addding the class sr-only (bootstrap):

<caption class="table-caption sr-only" data-bind="text: $t('Total')"></caption>

The code is in the file ../Magento/Checkout/view/frontend/web/template/cart/totals.html

I created my own base template and <theme> is a child of this (aka I don't extend from empty or luma). So I override the file in app/design/frontend/<vendor>/<theme>/Magento_Checkout/web/template/cart/totals.html

I deployed static content, flushed the cache (in the browser too).
So basically I did everything from this checked answer: https://magento.stackexchange.com/a/138238/42007
But my added class does not appear.

What did I miss?

Best Answer

  1. Check deploy mode, If deploy mode is not developer mode then set it.

    php bin/magento deploy:mode:set developer

  2. Check .htaccess is in pub/static/ folder or not. If not then please take from fresh magento and add it.

  3. Delete this file pub/static/frontend/<vendor>/<theme>/Magento_Checkout/web/template/cart/totals.html

  4. Deploy static content

rm -rf pub/static/*

rm -rf var/*

rm -rf var/view_preprocessed/*

php bin/magento setup:static-content:deploy