feat: Multiple book improvements

- Format spell tables like they are in the book
- Add permalinks to headers
- Formatting
- Book-wide search
This commit is contained in:
2026-06-26 20:50:14 -04:00
parent 7f81f85735
commit 5327b524d2
30 changed files with 25674 additions and 21123 deletions

View File

@@ -85,6 +85,25 @@ module.exports = (env, argv) => {
...(isProd
? [new MiniCssExtractPlugin({ filename: "[name].[contenthash].css" })]
: []),
// Register book HTML source files as compilation dependencies so webpack
// watches them in dev mode and triggers a rebuild when they change.
{
apply(compiler) {
compiler.hooks.afterCompile.tap("WatchBookPages", (compilation) => {
const bookDirs = [
path.resolve(__dirname, "books/core"),
path.resolve(__dirname, "books/natural-fantasy-atlas"),
];
for (const dir of bookDirs) {
try {
fs.readdirSync(dir)
.filter(f => f.endsWith(".html") && f !== "index.html")
.forEach(f => compilation.fileDependencies.add(path.join(dir, f)));
} catch (_) {}
}
});
},
},
new HtmlWebpackPlugin({
template: "./src/fabula-ultima-sheet.html",
filename: "index.html",
@@ -92,7 +111,7 @@ module.exports = (env, argv) => {
scriptLoading: "blocking",
}),
new HtmlWebpackPlugin({
templateContent: bookTemplate(
templateContent: () => bookTemplate(
"Fabula Ultima - Core Rulebook",
"Core Rules",
"./books/core"
@@ -102,7 +121,7 @@ module.exports = (env, argv) => {
scriptLoading: "blocking",
}),
new HtmlWebpackPlugin({
templateContent: bookTemplate(
templateContent: () => bookTemplate(
"Fabula Ultima - Natural Fantasy Atlas",
"Natural Fantasy Atlas",
"./books/natural-fantasy-atlas"