Whenever i make changes in knockout.js files and html file inside web folder. I have to run "setup:upgrade" and "static deploy" again. Is there any solution to avoid doing this?


Delete the Specific File Which you are modifying from Pub/Static Folder which is generated during the Initial deployment .

Once Deleted reload the site so the new static file will be created with new contents

  • Yes it's works...
    – Avesh Naik
    Apr 20 '18 at 12:14
  • 1
    Note that this doesn't work in websites that run in production mode
    – sduif
    Apr 20 '18 at 14:51

Yes - that is native flow of Magento 2 whenever you are doing any changes in JS file or CSS file you must have to run php bin/magento setup:static-content:deploy -f command.

For upgrade command - AKAIK you don't need to run each and every time when you change JS or HTML file. Upgrade command is only used when you are installing any new modules , and you might have database related changes in your existing module by Install/Upgrade Schema script.

So you don't need to run setup:upgrade command each time.

But for Assets like JS and CSS - This is native flow as assets are always served from pub/static directory so you must need to run that command.

  • upgrade command is need to clean static files.
    – Avesh Naik
    Apr 16 '18 at 14:33
  • because of your command i deleted .htaccess file in pub/static which created me lots of problem.
    – Avesh Naik
    Apr 17 '18 at 9:07
  • @avesh - ohh - yes you are correct , actually here we have done server level configuration where .htaccess is not removed - any way you resolved your issue ? Apr 17 '18 at 9:22
  • No man. Having same. I have to run those commands.
    – Avesh Naik
    Apr 17 '18 at 12:36
  • As i am new to magento 2 can i get tutorials on it?
    – Avesh Naik
    Apr 17 '18 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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