Skip to content

Conversation

@fehnomenal
Copy link
Contributor

Right now the svelte-scoped integration results in invalid css (at least from the perspective of vite-plugin-svelte) if in a rule in the style block there is only an apply (@apply or --at-apply) and this line ends with a semicolon.

Notice the double semicolon at the end of line 62:

09:43:08 [vite] (ssr) Error when evaluating SSR module /src/routes/+page.svelte: src/routes/+page.svelte:62:149 Declaration cannot be empty
https://svelte.dev/e/css_empty_declaration

- Did you forget to add a lang attribute to your style tag?
  Plugin: vite-plugin-svelte
  File: src/routes/+page.svelte:62:149
   60 |  <style>:global(._mx-auto_17hw2a){m... snip
   61 |    .corner {
   62 |      position:fixed;left:0.5rem;bottom:0.5rem;display:flex;--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity));padding:0.25rem;;
           ^
   63 |    }:global(.dark) .corner{--un-bg-opacity:1;background-color:rgb(0 0 0 / var(--un-bg-opacity));}@media (min-width: 768px){.corner{left:1.5rem;bottom:1.5rem;}}
   64 |   *{}</style>

This can be workedaround by adding anything that is no whitespace behind the --at-apply: line (I always used /*/). But this fixes the problem. I also added a check to not remove anything wrong if the line does not end with a semicolon.

@fehnomenal fehnomenal requested review from antfu and zyyv as code owners July 3, 2025 07:51
@netlify
Copy link

netlify bot commented Jul 3, 2025

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 0bb845c
🔍 Latest deploy log https://app.netlify.com/projects/unocss/deploys/68f0f3e6bfdff10008715be9
😎 Deploy Preview https://deploy-preview-4795--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 3, 2025

Open in StackBlitz

commit: 0bb845c

Copy link
Contributor

@henrikvilhelmberglund henrikvilhelmberglund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry for no review

@henrikvilhelmberglund henrikvilhelmberglund added this pull request to the merge queue Oct 16, 2025
Merged via the queue into unocss:main with commit 9a7c373 Oct 16, 2025
11 checks passed
@fehnomenal fehnomenal deleted the push-lwnvqllluyqy branch October 16, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants