I'm overriding a core JS file in my module. When I run

php bin/magento static-content:deploy

and refresh the page the JavaScript does not seem to change.

I started tracking the issue. I found that the file loaded in my pub/static/path_to_my_file is not updated. According to Magento 2 documentation it should have been updated, which is not happening.

Then after removing the pub/static folder design of frontend got ugly even after deploying static-content.

What is the cause and what is happening?


Well, it is not only your problem. It is kind of weakness or lets say feature should have been implemented in magento 2. It was supposed to work as you explained so well.

The reason you are unable to see the nice and well designed frontend is because you have deleted .htaccess file, used for establishing symlinks for static contents, that is within pub/static folder.

If you can revert the process or can get it from you git repo ,if you have, then you can create new one similar.

Next time when you want to deploy your particular js just delete your file pub/static/path_to_my_file and reload the browser. You will see that your new javascript will take effect like charm.

| improve this answer | |
  • It solved my problem. – Trzan Dec 8 '17 at 16:02

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.