move sssg to it's own repo at https://git.sad.ovh/sophie/sssg
All checks were successful
/ test (push) Successful in 14s
All checks were successful
/ test (push) Successful in 14s
This commit is contained in:
parent
031625f918
commit
d0084e9f44
11 changed files with 47 additions and 458 deletions
42
index.ts
Normal file
42
index.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import SSSG from "sssg";
|
||||
import Variables from "sssg/src/plugins/variables";
|
||||
import Dev from "sssg/src/plugins/dev";
|
||||
import TSCompiler from "sssg/src/plugins/ts-compiler";
|
||||
import MarkdownMetadata from "sssg/src/plugins/markdown-metadata";
|
||||
import MarkdownCompiler from "sssg/src/plugins/markdown-compiler";
|
||||
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
|
||||
const sssg = new SSSG({
|
||||
outputFolder: path.join(__dirname, "dist"),
|
||||
inputFolder: path.join(__dirname, "website"),
|
||||
});
|
||||
|
||||
await sssg.run({
|
||||
plugins: [
|
||||
new Variables(() => {
|
||||
const variables: Record<string, string> = {
|
||||
__BLOG_POSTS__: JSON.stringify(
|
||||
fs.readdirSync("./website/blogs").map((z) => z.replace(".md", ""))
|
||||
),
|
||||
};
|
||||
|
||||
if (fs.existsSync("./website/templates")) {
|
||||
for (const file of fs.readdirSync("./website/templates")) {
|
||||
const id = file.toUpperCase().replace(".HTML", "");
|
||||
variables["__TEMPLATE_" + id + "__"] = fs
|
||||
.readFileSync(path.join("./website/templates", file))
|
||||
.toString("utf8");
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
}),
|
||||
new TSCompiler(),
|
||||
new MarkdownMetadata(),
|
||||
new MarkdownCompiler(),
|
||||
new Dev(sssg),
|
||||
],
|
||||
});
|
||||
|
||||
await sssg.build();
|
||||
Loading…
Add table
Add a link
Reference in a new issue