ruoyi-plus-soybean/scripts/logo.ts

13 lines
428 B
TypeScript
Raw Normal View History

2023-02-09 23:25:00 +08:00
import { readFile, writeFile } from 'fs/promises';
import themeSettings from '../src/settings/theme.json';
2023-02-09 23:25:00 +08:00
async function updateFavicon(svgPath: string, color: string) {
const svgStr = await readFile(svgPath, 'utf-8');
const svgStrWithColor = svgStr.replace(/currentColor/g, color);
2023-02-09 23:25:00 +08:00
await writeFile('./public/favicon.svg', svgStrWithColor);
}
2023-02-09 23:25:00 +08:00
updateFavicon('./src/assets/svg-icon/logo.svg', themeSettings.themeColor);