-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling
Description
Describe the problem
Svelte adds svelte-xyz123
hashes to CSS rules and the corresponding elements, so that styles don't affect other components. This hash is based on the contents of the <style>
block.
This works but it means that the hashes change frequently between deployments. It might be better to default to hashing based on the filename instead. I think the reason we didn't originally do this was that not all project setups made the filename available to the compiler, but now that most people are using vite-plugin-svelte
that's probably not an issue any more.
Describe the proposed solution
Update this...
svelte/packages/svelte/src/compiler/validate-options.js
Lines 73 to 75 in 7b2d774
cssHash: fun(({ css, hash }) => { | |
return `svelte-${hash(css)}`; | |
}), |
...to this:
cssHash: fun(({ css, filename, hash }) => {
return `svelte-${hash(filename ?? css)}`;
}),
Importance
nice to have
uncenter, jycouet, Sendouc, jjones315, wont-work and 4 more
Metadata
Metadata
Assignees
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling