Preventing Asset caching during dev mode


Is this possible to somehow prevent the hard caching of Assets? Unfortunately when I work with eg. asset’s jquery file and when I modify the file, always the older version of jquery file is loading via the browser.

So every time after I modified the asset’s jquery file, I had to delete the generated assets file under the /web/assets.

This steps do my developing time slowly.

You could leave the jQuery file untouched. Then in "/web" directory make a folder "css" and put a stylesheet in there, and load it directly in your site.

I use the jQuery CDN and my stylesheet overrides what I need to. I personally don’t like editing the original jQuery file at all. It allows you to easily upgrade it in the future.

You could enable "forceCopy" for DEV mode, so when working locally it will copy over the assets fresh every single time. In your config:

    'components' => [

        'assetManager' => [

            'forceCopy' => YII_ENV_DEV ? true : false,