I'm using Yii2 basic application. I'm keeping two different asset bundles. One for module assets and another one for global themes assets. While loading the module controller, in view files I'm registering module asset bundle along with global theme asset bundle. But module asset bundles are compiled and files path are pointing to compiled directory not the real one like below:
<script src="/themes/app/js/jquery.uniform.js"></script>
<script src="/themes/app/js/myscript.js"></script>
<script src="/assets/50f10fbd/ckeditor.js"></script>
<script src="/assets/308fb5b9/js/cases.js"></script>
In the above four scripting tags, first two are loading from global theme assets and last two are loading from module assets bundle but module asset path are compiled one. Is it possible to compile global theme assets bundle also like modules?
Based on the names only I can not say if the files were compiled
- the only thing for sure is that they were simply copied to assets folder (which in terms of assets is publishing
).
Assets needs to be copied when they are not accessible from the public folder (default web
in basic template). In other case there is no need to copy them.
To force copy of the asset (publish
) you have to set $sourcePath in AssetBundle so assets manager can copy the files from there.
Of course once you need to publish
the assets you can compile them as well.
Read more about assets, publishing, grouping and compiling them in the Assets section of Yii 2 Guide.