Magento 2 – Changes to CSS and JavaScript Apply Only After Deploying Static Content

command linejs-cssmagento2

I installed Magento 2 from the Magento site. I have activated the developer mode by

{project directory}>php bin/magento setup:mode:set developer

Then I have installed my custom theme and finally I deployed my static content by

{project directory}>php bin/magento setup:static-content:deploy

My problem is I have to delete pub/static directory and deploy static content every time to apply the css and javacript changes. The static content deploy process is slow and taking so much time that it is very frustrating. I develop something and have to deploy to get the change to be appeared. Even for very small change. Flushing cache is not helping. Any help would be appreciated. Thanks in advance.

Best Answer

For now you only have this way to apply changes. Magento should be apply changes to pub/static dir but it not. This still know bug. Hope it should be fix soon
You can apply new changes by command as like you do. This way will take some times but should work
My way when i modify js from my extension . I just go to pub dir and clear folder

\pub\static\frontend\Magento\luma\en_US\<Vendor_Module>\js

You can do same with css files when customize styles

Related Topic