Changes to CSS and JavaScript applies only after d

2019-07-22 14:14发布

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.

1条回答
Animai°情兽
2楼-- · 2019-07-22 14:31

The grunt jobs should be enough to run when you change css.

So you can run:

grunt exec
grunt less

Or with specified theme name:

grunt exec:theme_name
grunt less:theme_name

Check in the database in core_config_data table and disable minify fields so Magento doesn't minify css / js while you develop. You can use this SQL query to disable those fields:

update core_config_data set value=0 where path in ('dev/css/minify_files', 'dev/css/merge_css_files', 'dev/js/minify_files', 'dev/js/merge_files')
查看更多
登录 后发表回答