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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user