How can I force assetic to render assets each time the page is reloaded?

后端 未结 4 534
别跟我提以往
别跟我提以往 2020-12-30 07:23

How can I force assetic to render assets each time the page is reloaded (no matter if assets are modified or not)?

More explanation about my issue:

I\'m curr

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-30 07:54

    AFAIK there's no perfect solution for this yet

    I use:

    php app/console assetic:dump --watch
    

    which will compile your .less files each time it detects a change in any of the .less files referenced on your templates.

    To force a compilation you have to make any change in your "main" file (the file that @imports the others). But, the good news are that is just enough to "touch" the file to do that. So you can just manually touch it every time you need:

    touch ~/web/css/main.less;
    

    Or, what i usually do is to set up a script that touches this "main" file each 60 seconds or so:

    while true; do
        sleep 60
        touch ~/web/css/main.less
    done
    

    This should work on linux and mac.

    Hope it helps. At least temporarily :)

提交回复
热议问题