domingues / rollup-plugin-css-chunks

Rollup plugin to extract CSS into chunks
MIT License
14 stars 8 forks source link

Readme clarification #1

Closed benmccann closed 4 years ago

benmccann commented 4 years ago

The readme says "Use rollup-plugin-extract-bundle-tree to extract dependencies between JS and CSS chunks." Does that mean that you need to use rollup-plugin-extract-bundle-tree to use this plugin or is it optional?

I'm also wondering how the CSS gets included in the document. Is there something that updates the JS to include a style or link tag into the document or is it the user's responsibility to somehow load the CSS?

benmccann commented 4 years ago

Ah, I see that you have to use and extract the bundle tree in order to use this plugin: https://github.com/domingues/svelte-ssr-example/blob/2fe9ae73757b68056723f1c321c0a1d6053ff66f/src/server.js

domingues commented 4 years ago

Yes, you have to use something like that to know what are the chunks that your module use. At some point I tried to use @import CSS rule so it work with only one CSS style sheet <link>. But in production nobody will do that to avoid cascade file downloads.