mirror of
https://github.com/zadam/trilium.git
synced 2026-01-01 20:24:25 +01:00
feat(icon-pack-builder): save attachment
This commit is contained in:
parent
850528750c
commit
035a311e4d
@ -33,6 +33,14 @@ async function main() {
|
||||
});
|
||||
note.setLabel("iconPack", iconPack.prefix);
|
||||
|
||||
// Add the attachment.
|
||||
note.saveAttachment({
|
||||
role: "file",
|
||||
title: iconPack.fontFile.name,
|
||||
mime: iconPack.fontFile.mime,
|
||||
content: iconPack.fontFile.content
|
||||
});
|
||||
|
||||
// Export to zip.
|
||||
const zipFilePath = `icon-pack-${iconPack.prefix}.zip`;
|
||||
const fileOutputStream = createWriteStream(zipFilePath);
|
||||
|
||||
@ -4,4 +4,9 @@ export interface IconPackData {
|
||||
name: string;
|
||||
prefix: string;
|
||||
manifest: IconPackManifest;
|
||||
fontFile: {
|
||||
name: string;
|
||||
mime: string;
|
||||
content: Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
import { extractClassNamesFromCss } from "../utils";
|
||||
|
||||
import type { IconPackData } from "../provider";
|
||||
import { extractClassNamesFromCss } from "../utils";
|
||||
|
||||
export default function buildIcons(): IconPackData {
|
||||
const baseDir = join(__dirname, "../../../../node_modules/@mdi/font");
|
||||
@ -15,5 +16,10 @@ export default function buildIcons(): IconPackData {
|
||||
manifest: {
|
||||
icons: extractClassNamesFromCss(cssFileContent, "mdi"),
|
||||
},
|
||||
fontFile: {
|
||||
name: "materialdesignicons-webfont.woff2",
|
||||
mime: "font/woff2",
|
||||
content: readFileSync(join(baseDir, "fonts", "materialdesignicons-webfont.woff2"))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user