-
Notifications
You must be signed in to change notification settings - Fork 19
/
node.test.mjs
46 lines (45 loc) · 1.51 KB
/
node.test.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import fs from 'fs-extra';
import { fontSplit } from '../dist/cn-font-split.js';
fs.emptyDirSync('./temp/node');
fontSplit({
destFold: './temp/node',
FontPath: '../demo/public/SmileySans-Oblique.ttf',
// FontPath: './test/temp/也字工厂小石头.ttf',
// FontPath: './test/temp/AlibabaPuHuiTi-3-85-Bold.otf',
// FontPath: './test/temp/字魂扁桃体.ttf',
// FontPath: './test/temp/京華老宋体v1.007.ttf',
// FontPath: './test/temp/SourceHanSerifSC.ttf',
// FontPath: './test/temp/AlibabaPuHuiTi-3-65-Medium.woff2',
targetType: 'woff2',
// subsets: JSON.parse(await fs.readFile("./subsets/misans.json", "utf-8")),
previewImage: {},
testHTML: true,
reporter: true,
css: {
// fontWeight: false
// localFamily: false,
// comment: false,
// comment: {
// base: false,
// nameTable: false,
// unicodes: true
// }
},
// buildMode: "stable",
// logger: {
// settings: {
// minLevel: 1,
// },
// },
// autoChunk: false,
// subsets: [[31105, 8413]],
// threads: {},
// renameOutputFont: '[hash:10][ext]',
// renameOutputFont: '[index][ext]',
// renameOutputFont({ transferred, ext, index }) {
// const algorithm = 'sha256'
// const hash = crypto.createHash(algorithm).update(transferred).digest('hex')
// // return index.toString() + ext // index 命名
// return hash.slice(0, 6) + ext // 短 hash 命名
// }
});