Skip to content

Commit

Permalink
feat: Support arbitrary variants in extension CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
areknawo committed May 6, 2024
1 parent 01c90f5 commit c07b432
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@types/nodemailer": "^6.4.14",
"@types/ws": "^8.5.10",
"@unocss/core": "^0.59.0",
"@unocss/extractor-arbitrary-variants": "^0.59.4",
"@unocss/preset-typography": "^0.59.0",
"@unocss/preset-wind": "^0.59.0",
"@unocss/transformer-compile-class": "^0.59.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/routes/utils/handlers/generate-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import transformerCompileClass from "@unocss/transformer-compile-class";
import transformerVariantGroup from "@unocss/transformer-variant-group";
import presetWind from "@unocss/preset-wind";
import presetTypography from "@unocss/preset-typography";
import extractorArbitrary from "@unocss/extractor-arbitrary-variants";
import { Context } from "#lib/context";

const inputSchema = z.object({ cssString: z.string(), uid: z.string().optional() });
Expand All @@ -21,6 +22,7 @@ const handler = async (
`${darkSubSelectorIndex >= 0 ? ".dark " : ""}${input.uid ? `[data-uid="${input.uid}"]` : ""} ${darkSubSelectorIndex >= 0 ? obj.selector.substring(darkSubSelectorIndex + 6) : obj.selector}`.trim();
}
],
extractors: [extractorArbitrary],
layers: {
"b1": -3,
"b2": -2,
Expand Down
15 changes: 14 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c07b432

Please sign in to comment.