yii2: Compressing assets is not working as expected.
I am using the extension scroll pager:
"require": { "kop/yii2-scroll-pager": "dev-master", },
I created an asset bundle to compress the asset kop\y2sp\assets\InfiniteAjaxScrollAsset and i have only 1 target ‘all’ in my compress script.
'all' => [ 'class' => 'yii\web\AssetBundle', 'basePath' => '@webroot', 'baseUrl' => '@web', 'js' => 'min/js/all{hash}.js', 'css' => 'min/css/all{hash}.css', ],
When i run my application, the compressed js is included but the individual js present in the asset are also included.
FYI: This seems to be happening for widgets only. I tried to compress 2 of kartik assets into 1 file and it is including both the compressed and the original files.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 18 (9 by maintainers)
Here is an step-by-step of what i did to simulate the problem:
create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basicyii asset/template assets.phpyii asset assets.php config/assets-prod.phpto compress.If you check the
assets-prod.phpfile, you will see that the compressing went fine and all assets are empty and depending ofall.But, if I overwrite the
AppAssetto look like this:The compressing will still work, however in my application I can see the original
site.cssbeing loaded:So, my question is: Is this the expected behavior of the Asset? Shouldn’t, after compressed, the asset never being able to rewrite their files somehow?
Or you guys think that using the
init()method to add properties is a bad practice for this class? As i said, I’m using an extension that have this situation and I already opened an issue there. I just would like to hear what you guys think about it or if i did something wrong in the process described.