I was working with magento 2 and trying to change some css whenever i change single line of css forexample i was trying to change the _module.less file in Magento_Theme/web/css/source whenever i change sinle line of it didnt show any change but when i remove content from pub/static folder and var/cache and var/view_preprocessed then i am able to see the change what could be the better solution for it to save time ? I am in a developer mode .


If you are in developer mode, you should be able to just refresh the page. Personally, I use grunt and livereload. However, if you are not using those, I find it helpful to do the following when I first start:

  1. rm -rf pub/static/frontend
  2. rm -rf var/cache
  3. rm -rf var/page_cache
  4. rm -rf var/view_preprocessed
  5. php bin/magento cache:disable full_page block_html
  6. php bin/magento cache:clean
  7. php bin/magento setup:static-content:deploy --area=frontend (this isn't truly necessary but I always do this when I begin the task and NOT on each change)

Also, if you still don't see the changes, flush your browser cache.

  • I am in a developer mode i am unable to see changes when i refresh the page ... to see the change i have to do the steps you have mentioned again and again . – Flutterer Feb 18 at 1:36
  • I just updated my answer. Try to follow it exactly, step by step and see what happens – Shawn Abramson Feb 18 at 1:37
  • no you dont understand my question when i remove the folders you have mentioned and deploy static content i see the changes but for every change i have to do this , i dont want to to do this .... i have tried your answer – Flutterer Feb 18 at 1:51

If your are editing less files you need to follow the steps mentioned on other answers. Or configure grunt task runners to compile the less once a file is changed.



Always Use developer mode when you are making changes to website.

For me, after making CSS/JS changes, i need to clear magento cache by running

php bin/magento cache:clean

and then clear Browser cache (Ctrl+Shift+Delete and Clear cache)


If you are changing in less file and want reflection of your changes withour removing static content, you should use client side compilation instead of server side compilation. Check this for more information:https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/css-preprocess.html

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.