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

Leftover css should read from unclaimed modules #1098

Merged
merged 1 commit into from
Feb 25, 2020
Merged

Leftover css should read from unclaimed modules #1098

merged 1 commit into from
Feb 25, 2020

Conversation

mapgrid
Copy link
Contributor

@mapgrid mapgrid commented Feb 23, 2020

Fixes #1076.

Commit 1b9b559 changed the array that leftover CSS pulls from. This causes main.css to include all CSS already included by entry_css_modules instead of only CSS from unclaimed modules. In practice, it duplicates all CSS to main.css.

Original

const leftover = get_css_from_modules(Array.from(unaccounted_for));

1b9b559

const leftover = get_css_from_modules(entry_css_modules, css_map, dirs);

Revert (in this PR)

const leftover = get_css_from_modules(Array.from(unclaimed), css_map, asset_dir);

@Conduitry Conduitry merged commit 2f48c89 into sveltejs:master Feb 25, 2020
@mapgrid mapgrid deleted the fixes/duplicate-css branch February 26, 2020 11:01
@PaulMaly
Copy link

PaulMaly commented Mar 1, 2020

@Conduitry @mapgrid Looks like this PR brought to that ALL styles now inlining to the <head> instead of creating a <link> for different CSS files. It's too much to inlining because if I need to have Bootstrap, for example, it won't be cached.

The latest version of Sapper inline all styles from _layout.svelte, route component (eg. index.svelte) and all its dependent components. See the screenshot from the homepage of starter template:

Снимок экрана 2020-03-01 в 18 42 53

And how it looks like on the real project:

Снимок экрана 2020-03-01 в 22 35 06

In fact, I can't scale my page to show all inlining styles and only 10% of them you see in the screenshot.

@Conduitry
Copy link
Member

Yeah that seems to be a significant problem. I've opened #1115.

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 generates duplicate CSS files
3 participants