kirbyup icon indicating copy to clipboard operation
kirbyup copied to clipboard

Asset strategy

Open jonaskuske opened this issue 1 year ago • 1 comments

Currently all assets imported in the frontend portion are included in the JS/CSS files as data URLs. This means that importing a single image can blow up the size of the JS to be parsed and executed to multiple MBs!

Would be great to somehow skip inlining the assets, but it doesn't appear that easy to solve, as the problematic behavior is built into Vite and not configurable:

  • https://vitejs.dev/config/build-options.html#build-assetsinlinelimit
  • https://github.com/vitejs/vite/issues/4454
  • https://github.com/vitejs/vite/issues/3295
  • https://github.com/vitejs/vite/pull/5028

Optimal would be some integrations so assets are loaded from the plugin's assets/ folder which Kirby automagically copies to the /media directory: https://getkirby.com/docs/guide/plugins/plugin-basics#plugin-assets

jonaskuske avatar Aug 09 '22 12:08 jonaskuske