Assetic doesn't update styles without cache:cl

2019-07-30 01:39发布

问题:

I have an app.less that imports everything (less) else if I comment a line in app.less app styles doesn't render the commented part, but if I change something in that imported less file, anything changes, I have to do cache:clear and to clear the browser cache to see the new style loaded...

回答1:

Assets that are imported from another stylesheet (less, sass, whatever) will not be recompiled when they change, even if you use php app/console assets:dump --watch. See another question on StackOverflow and this issue in the AsseticBundle issue queue.



回答2:

I came upon the same problem. This is caused because LESS is using your window.localstorage to save the rendered css file. For testing you could put in javascript

<script> /* Provisory for dev environment: */ window.localStorage.clear(); </script> 

however this causes your page to load really slow. i have not found another options for this just yet.