Magento – Frequent Css and js changes not reflecting Magento 2 in Windows environment

cssmagento2module

I am modifying a module which uses css and js.

OS : WINDOWS
Magento Mode : Developer

What I've tried :

php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
deleted cache folder under var/cache
deleted C:\xampp\htdocs\magento2\pub\static ( except .htaccess file)

By doing this all the css and js updates, but I have to do it each time even for minor css changes

In ubuntu, it works fine when I am in developer mode. I opened it private browser, even flushed the browser cache.

Update: In developer mode on windows environment if we delete all the files form pub/static folder and than refresh the page it will show the updated css and js .

I have no idea its the only way to work on windows environment as in Linux in developer mode everything got updated as we refresh the page.

To remove version number from files path
Stores>Configuration>Advanced>Developer>[ Static Files Settings tab] Sign Static Files to NO

Best Answer

Follow below mention steps to get "Frequent Css and js changes"

  1. Updating the JS in your respected module,before refreshing page the same file from pub/static/frontend/namespace/theme/ ... module/js/... delete it so after page refresh fresh JS file will generate in pub folder.
  2. Updating the CSS in your respected module, do the Pt. 1 for css.

for more info see this link, In this link i explained for LESS changes as well.

Note : After doing Pt. 1 or/and Pt. 2 still fresh code not reflect in browser then please do hard refresh

Cmd/Ctrl key + Shift key + press R

Related Topic