-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
44 lines (37 loc) · 1.01 KB
/
build.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Paged Markdown 3
* Lesosoftware 2022
*/
const { tasks, log, debug } = require('buildtool.js');
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
let sass = require('sass');
tasks
({
// TypeScript
'src/**.ts': [ 'dist/paged.js', async (src, dest) =>
{
log('tsc', dest);
execSync(__dirname + '/node_modules/.bin/spack');
// Patch footnote mapping
let patch = 'area = node.closest(".pagedjs_page_content");'
fs.writeFileSync(dest,
fs.readFileSync(dest).toString()
.replace(patch, patch+'\n' + ' '
.repeat(16) + 'if (!area) return;'));
}],
// SCSS
'src/(**).scss': [ 'dist/$1.css', async (src, dest) =>
{
log('scss', dest);
fs.writeFileSync(dest,
sass.renderSync(
{
file: src,
outFile: dest,
sourceMap: debug,
sourceMapEmbed: true
}).css);
}],
});