3 ms·
Nice and simple. One note to the author - you could reduce your line count quite a bit and get a bunch of features for free by using Nunjucks (https://mozilla.
by dugmartin 5y ago
Nice and simple. One note to the author - you could reduce your line count quite a bit and get a bunch of features for free by using Nunjucks (https://mozilla.github.io/nunjucks/ https://mozilla.github.io/nunjucks/) instead of parsing the template yourself. It handles your partials and variables in the same way plus a whole lot more.
- brettermeier 5y agoDo you really save lines of code if you add another dependency? Many lines of code are coming with that...
- dugmartin 5y agoAlways a tradeoff, but the author is already using these dependencies: const parse = require('node-html-parser').parse; const beautify = require('js-beautify').html; const loadYaml = require('js-yaml').load; const showdown = require('showdown');
- malkosta 5y agoThat's possible, not sure if I want. I would have to: 1. drop markdown support, and posts in HTML 2. find a way to parse HTML via regex, which is doable if I use a different notation than a tag for `<partial src=...` 3. use a language that has filesystem support natively, to read files without a dependency I'm working on 2 and 3. But I don't want to drop markdown support on the blog posts...so I guess I will live with this :)
- malkosta 5y agoYes I wanna get rid of all dependencies...just finding my way through it.