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

后端 未结 4 538
别跟我提以往
别跟我提以往 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

    I've created a simple script to solve this problem. Please try it out and let me know if it helped.

    #!/bin/bash
    
    # assetic-watch: A very simple shell-script to recursively and efficiently
    # watch for asset changes and to trigger automatic recompilation.
    #
    # By Slava Fomin II   
    # Feel free to contact me.
    # From Russia with Love.
    # Let's make this World a Better place!
    # --------------------------------------
    
    #===============#
    # CONFIGURATION #
    #===============#
    
    # Path relative to "Symfony/src" directory.
    # File changes under specified directory will trigger recompilation
    # of all assets.
    WATCH_PATH="Name/Bundle/NameBundle/Resources/public/css"
    
    # Environment.
    ENV="dev"
    
    # Additional options for "app/console".
    OPTS=""
    
    # inotifywait events to watch for.
    INW_EVENTS="close_write,moved_to,create"
    
    # Optional inotifywait arguments.
    INW_OPTS=""
    
    # Relative path to the Symfony root directory.
    SYMFONY_PATH="../"
    
    #============#
    # PROCESSING #
    #============#
    
    SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    CONSOLE_PATH="$SCRIPT_DIR/${SYMFONY_PATH}/app/console"
    SRC_PATH="$SCRIPT_DIR/${SYMFONY_PATH}/src/$WATCH_PATH"
    
    quietly() { "$@" > /dev/null 2>&1; }
    
    while true; do
        quietly inotifywait --recursive -e $INW_EVENTS $INW_OPTS $SRC_PATH
        php $CONSOLE_PATH assetic:dump --env=$ENV $OPTS
    done
    

    I really hope Symfony developers will address this issue in the future versions of the Assetic bundle. I believe it's a serious limitation.

提交回复
热议问题