sveltejs / kit

web development, streamlined
https://svelte.dev/docs/kit
MIT License
18.72k stars 1.94k forks source link

Dev SSR loader should track CSS dependencies #275

Closed Rich-Harris closed 3 years ago

Rich-Harris commented 3 years ago

At present, the dev server inlines 'critical' CSS which basically means this:

const rendered = options.root.render(props);

// ...
const styles = `<style>${rendered.css.code}</style>`

Leaving aside the lack of sourcemaps here, this doesn't totally work, because it only includes Svelte's own CSS. It doesn't include anything that was manually imported.

The dev loader just ignores CSS files altogether, but it could instead gather up those dependencies and report back

Rich-Harris commented 3 years ago

Turns out external CSS files also fail in build, during the optimisation step. Currently blocked by this so working on it

Rich-Harris commented 3 years ago

fixed by #279 and #286