Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Extend internal rollup plugin to replace extract_css #1415

Merged
merged 1 commit into from
Aug 25, 2020

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented Aug 18, 2020

Fixes #1397
Fixes #1388

This is testing out using the code from @ajbouh's fork to handle CSS. It uses the core of his implementation, but leaves out a lot of his changes unrelated to CSS handling to make it a smaller easier to review change. Thanks for providing this @ajbouh!

The reason I like this approach is that I think it makes sense that css handling would happen in a Rollup plugin. E.g. Rollup handles calculating the file hash for us automatically which fixes the bug where it wasn't calculated correctly.

This plugin essentially produces a graph and then figures out how to create the CSS files that are necessary. It also handles dynamic imports a bit better than master does. It puts the CSS for dynamic imports into the file for the route that does the dynamic import. master simply put it into main.css so that it was available everywhere. This could probably be further optimized, but I think it's a reasonable first implementation and an improvement over what we have today

The plugin could almost be refactored out to be a standalone CSS code splitting Rollup plugin. However, that would probably depend on cutting a new release of rollup-plugin-svelte and requiring users to use the latest version which takes advantage of Rollup's asset handling (sveltejs/rollup-plugin-svelte#72)

@benmccann benmccann force-pushed the adamb-code branch 27 times, most recently from 253d50b to 29f4123 Compare August 19, 2020 03:02
@benmccann benmccann marked this pull request as ready for review August 19, 2020 03:06
@antony antony self-requested a review August 20, 2020 11:18
@benmccann benmccann force-pushed the adamb-code branch 3 times, most recently from f7faf5f to e27ba3b Compare August 25, 2020 19:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sapper@0.28.0 generates 2 css files with identical content css files have incorrect hashes
2 participants