Browse Source

Fix font syncing

Ignore importing tailwind config for score renderer.
master
TheoryOfNekomata 8 months ago
parent
commit
0c1f6ed2c5
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/pages/scores/[asset].svg.ts

+ 2
- 1
src/pages/scores/[asset].svg.ts View File

@@ -4,7 +4,7 @@ import { readFile, readdir } from 'node:fs/promises';
import { JSDOM } from 'jsdom';
import type {APIRoute, GetStaticPaths} from 'astro';
// @ts-ignore
import tailwindConfig from '../../../tailwind.config.mjs';
import tailwindConfigRaw from '../../../tailwind.config.mjs';

const filter = (musicXml: string) => {
const jsdom = new JSDOM(musicXml, { pretendToBeVisual: true, contentType: 'image/svg+xml' });
@@ -41,6 +41,7 @@ const processOutput = (xmlData: string) => {
return;
}
if (h.tagName.toLowerCase() === 'style') {
const tailwindConfig = tailwindConfigRaw as any;
h.innerHTML = h.innerHTML.replace(/Times,serif/g, tailwindConfig.theme.fontFamily.body.join(','));
}
if (svgElemsMain.children[0]) {


Loading…
Cancel
Save