Skip to content

Commit bfc0468

Browse files
committed
inline css images and fonts
closes #786
1 parent 4a75582 commit bfc0468

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/rollup.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ function rewriteInputsNamespace(code: string) {
2222
return code.replace(/\b__ns__\b/g, "inputs-3a86ea");
2323
}
2424

25+
const INLINE_CSS = Object.fromEntries(
26+
["svg", "png", "jpeg", "jpg", "gif", "eot", "otf", "woff", "woff2"].map((ext) => [`.${ext}`, "dataurl" as const])
27+
);
2528
export async function bundleStyles({path, theme}: {path?: string; theme?: string[]}): Promise<string> {
2629
const result = await build({
2730
bundle: true,
31+
loader: INLINE_CSS,
2832
...(path ? {entryPoints: [path]} : {stdin: {contents: renderTheme(theme!), loader: "css"}}),
2933
write: false,
3034
alias: STYLE_MODULES

0 commit comments

Comments
 (0)