Magento 2.1 Theme – How to Speed Up Static Content Deploy for Development

deploymagento-2.1magento2static-contenttheme

Especially after changing .html knockout js template files I have to always deploy static content with bin/magento setup:static-content:deploy <languages>.
This makes development very slow.
I can just delete all static contents and let it create on the fly but that is no alternative as it will raise page load times to 15+ seconds (sometimes more than a minute.)

How can I improve this situation?

Best Answer

  1. delete all your static content
  2. deploy the static content with bin/magento setup:static-content:deploy <languages>
  3. change whatever file you need to change ie. <vendor>/.../web/template/shipping.html
  4. search for shipping.html in pub/static or in var (like view_preprocessed) for other files and delete only the file in question ie. shipping.html
  5. reload the page

Now Magento will use static files except for the file you are working on which will be generated on the fly (or used via symlink). If you want to have it static again just re-deploy static files.