blacksmoke26 / yii2cdn

A Yii Framework 2 component for using assets in different environments (Local/CDNs)
Apache License 2.0
14 stars 2 forks source link

Dependency management and compatibility with native Asset Bundles #7

Open dbd5 opened 7 years ago

dbd5 commented 7 years ago

If I could just make a suggestion for your consideration;

The native Yii2 AssetBundle design takes care of dependency where an asset must be loaded before another. I've also found that by overriding the AssetBundle init() method, other types of magic is possible.

Secondly, the assets available in Bower should not need to be copied from vendor/bower to another location to work. Perhaps a more elegant configuration design will be for the configuration to match a local asset in vendor/bower with the cdn based equivalent such that when the CDN is not available or when it is turned off with YII2CDN_OFFLINE, the regular assets are published by Yii, otherwise, the cdn equivalent is published.

Do you think this is an idea worth implementing?

blacksmoke26 commented 6 years ago

Yeah! Great! I have planned to re-write the code. I will think about that!