Assetic doesn't update styles without cache:clear

孤街醉人 提交于 2019-12-11 09:29:02

问题


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.



来源:https://stackoverflow.com/questions/13336880/assetic-doesnt-update-styles-without-cacheclear

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!