I'm just wondering why don't you guys compile all the cpresources into 1 .js and 1 .css file?
Right now this folder is gigantic :D cfr: https://i.stack.imgur.com/UixpA.png
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.
Sign up to join this communityI'm just wondering why don't you guys compile all the cpresources into 1 .js and 1 .css file?
Right now this folder is gigantic :D cfr: https://i.stack.imgur.com/UixpA.png
Craft CMS 3 uses Yii2 Asset Bundles for AdminCP resources. This lets it handle dependencies such as certain scripts not loading before jQuery, for example.
Remember that many Craft CMS 3 components need to publish JS/CSS resources to work, as do third party plugins. Some system needs to manage these things, and their dependencies.
Combining it all into one isn’t practical, since different pages require different resources, and plugins may add resources in arbitrarily. If you really did combine everything needed for the AdminCP backend, it’d be slow to build (and that build would have to be done dynamically as other components add/remove resources), and not very useful, especially with http/2 and multiple streams.
Note that the way it works now is a vast improvement over Craft 2.x, where every AdminCP static resource request went through the index.php
, and this was slow to load, and could not be cached.
Just ignore the cpresources/
directory; consider it a cache that you don't need to worry about.