Migrate from Metalsmith to Smed

This commit is contained in:
Anders Englöf Ytterström 2026-05-16 19:09:26 +02:00
parent afd0d72ce6
commit a93dadbd32
2 changed files with 13 additions and 51 deletions

13
cv.py Normal file
View file

@ -0,0 +1,13 @@
from smed import Smed
from smed_layouts import layouts
from smed_markdown import markdown
(
Smed()
.source("./src")
.destination("./pub")
.static(["*.css", "*.pdf"])
.use(markdown())
.use(layouts())
.build()
)

View file

@ -1,51 +0,0 @@
var Metalsmith = require("metalsmith");
var htmlMinifier = require("metalsmith-html-minifier");
var layouts = require("metalsmith-layouts");
var markdown = require("metalsmith-markdown-remarkable");
var permalinks = require("@metalsmith/permalinks");
var static = require("metalsmith-static");
var puppeteer = require("puppeteer");
var srcHTML = "file:" + __dirname + "/pub/index.html";
var destPDF = "./pub/cv-anders-englof-ytterstrom.pdf";
async function generatePDF() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(srcHTML, {
waitUntil: "networkidle2",
});
await page.pdf({
path: destPDF,
});
await browser.close();
}
Metalsmith(__dirname)
.source("./src")
.destination("./pub")
.use(
markdown({
html: true,
typographer: false,
}),
)
.use(permalinks())
.use(
layouts({
engine: "handlebars",
}),
)
.use(htmlMinifier())
.use(
static({
src: "./assets",
dest: "./",
}),
)
.build(function (err, _files) {
if (err) {
throw err;
}
generatePDF();
});