unocss / unocss

The instant on-demand atomic CSS engine.

Home Page:https://unocss.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

At-media rule for lg: and md: prefixes missing closing curly brace on output file when using the CLI

Guz013 opened this issue · comments

commented

UnoCSS version

0.60.3

Describe the bug

The CLI to output a .css file seems to break when using sm: and lg: prefixes together in a file, having the ending curly brace of the at-media rule missing. This causes all following classes definition to only apply when the at-media tag is applied.
The ending at-media rule without a curly brace

Reproduction

Minimal reproduction on Stackblitz, when using the npm run unocss command, the output file (./uno.css) has a curly brace missing after the at-media declarations.

It seems to be caused/related by the ./**/*.{js,css,html} entry pattern in the config, since when it's changed to ./*.{js,css,html} the resulting uno.css is correct (on my project it is ./static/**/*.{js,css,html}, and it also compiles correctly when commented out, however when changing to ./static/*.{js.css.html} it doesn't). Changing the output file path or name doesn't fix anything/it doesn't seem to be a some sort of recursion problem.

(The HTML snipped in the reproduction is just a copy-paste from my project where I found the bug)

System Info

No response

Validations

commented

Removing the css from the entry pattern ./static/**/*.{js,css,html} in my project seems to be a temporary fix to the issue. Is this intentional? Unfortunately, I wasn't able to get responses on the Discord.

I'm having the same issue. This was working fine till 0.59.1. I updated to 0.60.4 and it started breaking. It might have broke somewhere before that version as well, but 0.59.1 was definitely fine. In my case removing a CSS file from processing did not fix it. Here's my repo: https://github.com/hrishikesh-k/tejal. You can run npm i && npm run build. The first build might take time to process a lot of images, but till that's done, you can inspect the ./assets/css/uno.css file or copy it somewhere to inspect it later as it will be deleted once the build fails.

Just tested and it worked fine till 0.60.2. 0.60.3 is the version where this broke.