-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpublish.js
More file actions
24 lines (18 loc) · 765 Bytes
/
publish.js
File metadata and controls
24 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import * as fs from 'fs';
import * as path from 'path';
import pug from 'pug'
import ttf2woff2 from 'ttf2woff2'
import svg2ttf from 'svg2ttf'
const pugFile = path.resolve('./views/index.pug');
export const generateHTML = (pugFile) => {
const html = pug.renderFile(pugFile, {pretty: true});
const newFileName = path.resolve('./docs/index.html');
fs.writeFileSync(newFileName, html);
}
generateHTML(pugFile)
const svgFontPath = path.resolve('./docs/fonts/font.svg');
const ttfFontPath = path.resolve('./docs/fonts/font.ttf');
const ttf = svg2ttf(fs.readFileSync(svgFontPath, 'utf8'), {});
fs.writeFileSync(ttfFontPath, Buffer.from(ttf.buffer));
const ttfData = fs.readFileSync(ttfFontPath);
fs.writeFileSync('./docs/fonts/font.woff2', ttf2woff2(ttfData));