Answers.Body: <p>Craft CMS 3 uses <a href="http://www.yiiframework.com/doc-2.0/guide-structure-assets.html" rel="noreferrer">Yii2 Asset Bundles</a> for AdminCP resources. This lets it handle dependencies such as certain scripts not loading before jQuery, for example. </p>
  
  <p>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.</p>
  
  <p>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 <em>everything</em> 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. </p>
  
  <p>Note that the way it works now is a vast improvement over Craft 2.x, where every AdminCP static resource request went through the <code>index.php</code>, and this was slow to load, and could not be cached.</p>
  
  <p>Just ignore the <code>cpresources/</code> directory; consider it a cache that you don't need to worry about.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-18T17:30:01.057Z
Answers.Text: Ok thnx for the explanation!
  
  One more thing, you said "Just ignore the cpresources/ directory; consider it a cache that you don't need to worry about.". Does this mean we can just delete this folder and the files will be recreated automagicly?
Answers.UserDisplayName: Kobe Aerts
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-18T21:32:47.840Z
Answers.Text: Yes, you can delete the folder and it will be recreated automagically.
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-17T15:05:01.610Z
Answers.LastActivityDate: 2018-03-17T16:00:58.223Z
Answers.LastEditDate: 2018-03-17T16:00:58.223Z
Answers.UserDisplayName: andrew.welch
Body: <p>I'm just wondering why don't you guys compile all the cpresources into 1 .js and 1 .css file?</p>
  
  <p>Right now this folder is gigantic :D 
  cfr: <a href="https://i.sstatic.net/UixpA.png" rel="noreferrer">https://i.sstatic.net/UixpA.png</a></p>
  
Tags: <control-panel>
Title: Why is the cpresources folder so big?
ThreadText: # Why is the cpresources folder so big?
  
  (Asked by: username_0 on 2018-03-17)
  
  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.sstatic.net/UixpA.png>
  
  **Tags:** control-panel
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-17. Score: 9
  
  Craft CMS 3 uses [Yii2 Asset Bundles](http://www.yiiframework.com/doc-2.0/guide-structure-assets.html) 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.
  
  > **Comments:**
  > **username_0**: Ok thnx for the explanation!  One more thing, you said "Just ignore the cpresources/ directory; consider it a cache that you don't need to worry about.". Does this mean we can just delete this folder and the files will be recreated automagicly?  
  > **username_2**: Yes, you can delete the folder and it will be recreated automagically.  
  
  ---
  
  