-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plain imported css files and style tags are loaded twice #2192
Comments
nulladdict
changed the title
css files from
Plain imported css files are loaded twice
Aug 13, 2021
__layout.svelte
are loaded twice
nulladdict
changed the title
Plain imported css files are loaded twice
Plain imported css files and style tags are loaded twice
Aug 13, 2021
I cannot reproduce this with |
Yes, in |
I'm actually getting the exact same issue with recent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Plain css files that are imported in
__layout.svelte
get duplicated in the resulting page.In the demo app
__layout.svelte
containsimport '../app.css'
, but the resulting index html page on the client has two corresponding<link rel="stylesheet" href="…" />
tags.First comes from the SSR or pre-render, second gets added by the router when client-side javascript takes over.
Disabling javascript or using
export const router = false
on the index page gets rid of the second stylesheet.Moving the import from
__layout.svelte
to theindex.svelte
seems to still add 2 stylesheets, but declarations no longer appear twice inside the inspector.Upd: Moving the styles from
app.css
to the<style />
tag inside the__layout.svelte
does not seem to help. So it seems like it's a general css loading issue.It seems that browsers are smart enough to not re-download the stylesheet, so this bug is only a minor annoyance when looking at the dev tools.
Reproduction
npm init svelte@next
npm istall && npm run build && npm run preview
:root
declaration shows 2 times inside the Chrome's style inspector window<link rel="stylesheet" href="/./_app/assets/pages/__layout.svelte-hash.css">
<link rel="stylesheet" href="/_app/assets/pages/__layout.svelte-hash.css">
Logs
Shouldn't be necessary.
System Info
Severity
annoyance
Additional Information
Issues #1214 and #2130 might be related, but if I understood them correctly they only happen in dev, while I noticed the bug in prod when using
adapter-static
The text was updated successfully, but these errors were encountered: