Is there any way to reflect the css,js changes without running static content deploy in Magento 2?
-
10-03-2021 - |
Question
Is there any other method other than running deploy command to get new changes in the files in Magento 2?
Solution
To Reflect the Changes just Remove that Deployed file in pub/static
folder
Magento 2 will auto create the missing/deleted static files.
Created Command For Deleting this :-
rm -rf pub/static/frontend/ pub/static/adminhtml/ pub/static/_requirejs pub/static/deployed_version.txt var/cache var/page_cache var/generation var/view_preprocessed var/session generated/code
For Window Set Developer Mode :-
In Developer Mode Static view files are not cached; they are written to the Magento pub/static directory every time they’re called
bin/magento deploy:mode:set developer
OTHER TIPS
If you want to reflect the JS and CSS changes on the fly, you need to be set the mode to developer, the JS resources will be created as symlinks in the pub folder on the fly and the changes you made either to the ones in the pub folder or the original ones will update both of the files.
For the CSS resources, you will need to remove the compiled one in the pub folder, along with the one in the var/view_preprocessedvar/ folder
Check this : https://www.youtube.com/watch?v=1SOeJN6PcJI
Sorry have to entered due to character limit :)