diff --git a/cv.py b/cv.py new file mode 100644 index 0000000..c45b105 --- /dev/null +++ b/cv.py @@ -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() +) diff --git a/index.js b/index.js deleted file mode 100644 index c880d37..0000000 --- a/index.js +++ /dev/null @@ -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(); - });