-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.mjs
47 lines (39 loc) · 1.42 KB
/
gulpfile.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
47
const { task, src, dest, series, parallel } = (await import("gulp")).default
import { compileTexToDVIVinyl } from "./lib/compileTex.mjs"
import { combineSymbols, convertDVItoSVGsymbol } from "./lib/convertDviToSymbol.mjs"
import { createNodeTexFiles, createPathTexFiles } from "./lib/createTexFilesTasks.mjs"
import { filterNewer } from "./lib/vinylTools.mjs"
var concat = (await import("gulp-concat")).default
task("createNodeTexFiles", createNodeTexFiles)
task("createPathTexFiles", createPathTexFiles)
task("createTexFiles", parallel("createNodeTexFiles", "createPathTexFiles"))
task("buildDVI", function () {
return src("build/*.tex", {
read: false,
// @ts-ignore .d.ts is incomplete; gulp does accept `stat`
stat: true,
})
.pipe(filterNewer(".dvi"))
.pipe(compileTexToDVIVinyl())
})
task("buildSVG", function () {
return src("build/*.dvi", {
read: false,
// @ts-ignore .d.ts is incomplete; gulp does accept `stat`
stat: true,
})
.pipe(filterNewer(".svg"))
.pipe(convertDVItoSVGsymbol())
.pipe(dest("build/"))
})
task("buildSymbol", function () {
return src("build/*.svg", {})
.pipe(concat("symbols.svg", { newLine: "" }))
.pipe(combineSymbols())
.pipe(dest("./"))
})
task("createSymbols", series("buildDVI", "buildSVG", "buildSymbol"))
//EXPLANATION
//run this to rerender all symbols defined in nodes.jsonc
//run via "npx gulp" or "npx gulp default"
task("default", series("createTexFiles", "createSymbols"))