Skip to content

Commit 97ba929

Browse files
authored
fix(unocss): update createGenerator usage (#14)
2 parents 2c87e6e + f7cbc9e commit 97ba929

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugins/unocss.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Preset, UserConfig } from "https://esm.sh/@unocss/[email protected]";
2-
import { UnoGenerator } from "https://esm.sh/@unocss/[email protected]";
2+
import { createGenerator } from "https://esm.sh/@unocss/[email protected]";
33
import presetWind from "https://esm.sh/@unocss/[email protected]?bundle&no-dts";
44
import type { Plugin } from "../html.tsx";
55

@@ -13,7 +13,7 @@ const defaultUnoConfig: UserConfig = {
1313
};
1414

1515
export default function UnoCSS(config = defaultUnoConfig): Plugin {
16-
const uno = new UnoGenerator(config);
16+
const unoPromise = createGenerator(config);
1717
return async (ctx) => {
1818
let input = ctx.body;
1919
if (ctx.classes?.html) {
@@ -22,6 +22,7 @@ export default function UnoCSS(config = defaultUnoConfig): Plugin {
2222
if (ctx.classes?.body) {
2323
input += `<body class="${ctx.classes.body.join(" ")}">`;
2424
}
25+
const uno = await unoPromise
2526
const { css } = await uno.generate(input);
2627
ctx.styles.push(unoResetCSS, css)
2728
};

0 commit comments

Comments
 (0)