Commit 83cbb47
committed
refactor: split monolithic compress-fonts.js into modular architecture
Split 1347-line script into 6 focused modules under scripts/compress-fonts/:
- utils.js: shared file traversal, string extraction, markdown parsing
- config-parser.js: single-read siteConfig.ts parser with cached results
- text-collector.js: unified text collection from 8 sources
- font-compressor.js: Fontmin subsetting + ttf-to-woff2 conversion
- css-rewriter.js: dist/ CSS font reference rewriting
- index.js: entry point
Key improvements:
- siteConfig.ts read once (was 5+ times)
- String extraction code deduplicated (was 4 copies, now 1 function)
- Config parsing centralized with dedicated getter functions1 parent 599dd3e commit 83cbb47
8 files changed
Lines changed: 1112 additions & 1348 deletions
File tree
- scripts
- compress-fonts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
0 commit comments