-
Notifications
You must be signed in to change notification settings - Fork 16.2k
/
index.js
26 lines (19 loc) · 854 Bytes
/
index.js
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
const path = require('path');
const fs = require('fs');
const {version} = JSON.parse(fs.readFileSync('package.json'));
const compileMD = require('./compileMD');
const compileAnimationList = require('./compileAnimationList');
const templatePath = path.join(__dirname, 'template.html');
const template = fs.readFileSync(templatePath, 'utf8');
const outputPath = '../docs';
const outputFile = 'index.html';
const docs = compileMD();
const list = compileAnimationList();
const output = path.join(__dirname, outputPath, outputFile);
const withDocs = template.replace('{{docs}}', docs);
const withListAndDocs = withDocs.replace('{{list}}', list);
const withVersion = withListAndDocs.replace('{{version}}', version);
fs.writeFile(output, withVersion, 'utf8', (err) => {
if (err) console.error(err);
console.log('Template compiled succesfully.');
});