I have a js file. Everytime I change something I need to execute the following commands:

php bin/magento setup:upgrade 
php bin/magento setup:static-content:deploy 
php bin/magento setup:static-content:deploy nl_NL

nl_NL it's my case. Is there a way to avoid this ? cuz it is very frustrating :).

  • Development or production website? – Ryan Hoerr Mar 3 '17 at 14:06
  • production, but if I enable development mode it is so much slow. – Attila Naghi Mar 3 '17 at 14:08

go to your js file from pub/static/frontend/vendor_name/theme_name/......

and open your file, edit and save after that just delete the browser cache only... using(ctrl+shift+del) then press ctrl+f5. it will reflect your changes without doing setup:static-content...bla..bla

(note: if your changes set to be finalized then copy that js file from pub/static/.... and paste int your theme directory like app/design/frontend.... )

  • in my case there is a checkout JS . I tried your idea , but I still got the old version of js in my browser. – Attila Naghi Mar 3 '17 at 14:44

You can use the path to the file found in your network tab to make sure you are editing the correct file.

console network tab

This way you can be sure that you are editing the correct file. To agree with Ashik, I always do my de-bugging in the JS file that is served to the browser while working through a feature or a problem. But be sure to copy the work you do over to the file in your theme. When you run your deploy commands, any work in the pub/static/ folders will be lost.

Doing any file edits in production mode is going to be unreliable. I understand that M2 is very slow compared to some other systems, but it's really just to cost of the framework. I hate to say, but i don't think there is a predictable workflow for developing on production mode.

One idea comes from Alan Storm:


He is using redis to speed things up while developing.

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.