chore(icon_pack): generate root declaration

This commit is contained in:
Elian Doran 2025-12-26 18:08:26 +02:00
parent b157cd909c
commit 93a3b29677
No known key found for this signature in database
2 changed files with 17 additions and 0 deletions

View File

@ -126,8 +126,12 @@ describe("CSS generation", () => {
expect(processedResult).toBeTruthy();
const css = generateCss(processedResult!);
console.log(css);
expect(css).toContain("@font-face");
expect(css).toContain("font-family: 'trilium-icon-pack-bx'");
expect(css).toContain(`src: url('/api/attachments/${processedResult?.fontAttachmentId}/download') format('woff2');`);
expect(css).toContain("@font-face");
expect(css).toContain("font-family: 'trilium-icon-pack-bx' !important;");
});
});

View File

@ -70,5 +70,18 @@ export function generateCss(processedIconPack: ProcessResult) {
font-style: normal;
src: url('/api/attachments/${processedIconPack.fontAttachmentId}/download') format('${MIME_TO_CSS_FORMAT_MAPPINGS[processedIconPack.fontMime]}');
}
.${processedIconPack.manifest.prefix} {
font-family: 'trilium-icon-pack-${processedIconPack.manifest.prefix}' !important;
font-weight: normal;
font-style: normal;
font-variant: normal;
line-height: 1;
text-rendering: auto;
display: inline-block;
text-transform: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
`;
}