1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-28 02:29:38 +01:00
deka-dom-el/bs/docs.js

27 lines
1016 B
JavaScript
Raw Normal View History

2023-09-26 16:02:10 +02:00
#!/usr/bin/env nodejsscript
/* jshint esversion: 11,-W097, -W040, module: true, node: true, expr: true, undef: true *//* global echo, $, pipe, s, fetch, cyclicLoop */
2023-11-07 15:10:55 +01:00
echo("Building static documentation files…");
echo("Preparing…");
2023-11-10 17:15:59 +01:00
import { path_target, pages, styles, dispatchEvent } from "../docs_src/ssr.js";
2023-09-26 16:02:10 +02:00
import { createHTMl } from "./docs/jsdom.js";
import { register } from "../jsdom.js";
const pkg= s.cat("package.json").xargs(JSON.parse);
2023-11-07 15:10:55 +01:00
for(const info of pages){
const { id }= info;
echo(`Generating ${id}.html…`);
const ssr= createHTMl("");
const { el }= await register(ssr.dom);
2023-11-10 17:15:59 +01:00
const { page }= await import(`../docs_src/${id}.html.js`); //→ TODO: important to mention in docs!!!
2023-11-07 15:10:55 +01:00
document.body.append(
2023-11-10 17:15:59 +01:00
el(page, { pkg, info }),
2023-11-07 15:10:55 +01:00
);
echo.use("-R", `Writing ${id}.html…`);
2023-11-10 17:15:59 +01:00
dispatchEvent("oneachrender", document);
2023-11-07 15:10:55 +01:00
s.echo(ssr.serialize()).to(path_target.root+id+".html");
}
2023-11-10 17:15:59 +01:00
s.echo(styles.content).to(path_target.css+styles.name);
dispatchEvent("onssrend");
2023-11-07 15:10:55 +01:00
echo("Done");