-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling
Description
Describe the bug
Since I can't pass scoped css to child components in Svelte, I use preprocess to do this. When I migrated to Svelte 5, I thought there was a problem when I saw svelte-{hash} classnames in my snapshots. When I printed the cssHash function, it wrote the path of my library.
Reproduction
- Create project with svelte 5.
- Use svelte-preprocess-cssmodules in your project.
- Create library with svelte 4.
- Use svelte-preprocess-cssmodules in your library.
- Use your created library in your created project.
- You can see svelte prefixed classes.
Logs
Css Hash output (filename and css props)
/Users/.../my-project/.../ContentCard.svelte :global(.container) {
flex: 1;
display: flex;
flex-direction: column;
gap: 24px;
}
:global(.container.horizontal) {
flex-direction: row;
}
:global(.container.horizontal .sizes) {
flex: 1;
}
:global(.separator) {
height: 1px;
background-color: var(--bl-color-neutral-lighter);
display: none;
}
:global(.separator:has(+ *)) {
display: block;
}
:global(.separator.horizontal) {
height: auto;
width: 1px;
}
/Users/X/my-project/node_modules/my-library/dist/.../Box.svelte
:global(.box-XSmnzi) {
padding: var(--box-padding);
border-radius: var(--top-border-radius) var(--top-border-radius) var(--bottom-border-radius)
var(--bottom-border-radius);
background: white;
}
:global(.box-XSmnzi > [data-remove-margin]) {
margin-left: calc(var(--box-padding) * -1);
margin-right: calc(var(--box-padding) * -1);
}System Info
System:
OS: macOS 15.2
CPU: (10) arm64 Apple M1 Pro
Memory: 179.03 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 9.4.0 - /usr/local/bin/pnpm
bun: 1.1.17 - ~/.bun/bin/bun
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 132.0.6834.160
Safari: 18.2
npmPackages:
@sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.4
svelte: ^5.0.0 => 5.19.1
svelte-preprocess-cssmodules: ^3.0.0 => 3.0.0
vite: ^5.4.10 => 5.4.10Severity
annoyance
Metadata
Metadata
Assignees
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling