https://handlebarsjs.com/guide/partials.html#basic-partials
https://blog.teamtreehouse.com/handlebars-js-part-2-partials-and-helpers
Can we explore Partials?
I and @Mira-Alf looked into it and we both agreed: Bad Idea.
Partials are horribly complicated and wouldn't solve any problem, rather create new ones.
Mira partially solved the page break problem using a CSS property. It can't be completely solved without imposing some restrictions on image sizes and embedded tweet sizes or so. Big enough entities will break.
@tolgaerdonmez is working on replacing handlebars templates with svelte SSR'd components. These components will be agnostic, and can be composed easily and flexibly for both EPUB and PDF code. Thanks to Svelte, we'd be able to develop and design the templates just like we do web development: Running a dev server.
We have both looked into pdfkit and we don't think we are capable of writing scalable, future-proof, and overall capable-enough implementation. Here's why:
Canvas API. It prioritizes drawing objects on the pages rather than making documents the HTML way. You have to calculate and assign manual coordinates to every single thing. That alone makes it highly unfavorable.Text, Image, components, and these are highly likely to be very inflexibleI favor this approach:
Tolga and I discussed about Puppeteer on AWS Lambda. We think it is feasible.
cc @johnjacobkenny
I am okay with sveltejs as long as it doesnt cause any new issues and everyone is onboard with the idea. Like @PuruVJ mentioned, handlebars doesnt solve all the formatting issues - I just solved the pagebreak issue but even that some of the linkboxes still cause some issues. And newer issues might crop up for github and hackernews formats as well. If sveltejs is AWS lambda compatible then I am all for it.
I'll have to catch up with these!!
I also agree with @PuruVJ about handlebars to svelte transition. It would be much better to handle things in a more code splitted, more controllable with bare js logic and such. 馃憤馃憤馃憤
I suppose this can be closed as Mira has introduced Partials and we have agreed on Svelte as an experiment.
Most helpful comment
I and @Mira-Alf looked into it and we both agreed: Bad Idea.
Partials are horribly complicated and wouldn't solve any problem, rather create new ones.
Mira partially solved the page break problem using a CSS property. It can't be completely solved without imposing some restrictions on image sizes and embedded tweet sizes or so. Big enough entities will break.
@tolgaerdonmez is working on replacing handlebars templates with svelte SSR'd components. These components will be agnostic, and can be composed easily and flexibly for both EPUB and PDF code. Thanks to Svelte, we'd be able to develop and design the templates just like we do web development: Running a dev server.
We have both looked into pdfkit and we don't think we are capable of writing scalable, future-proof, and overall capable-enough implementation. Here's why:
CanvasAPI. It prioritizes drawing objects on the pages rather than making documents the HTML way. You have to calculate and assign manual coordinates to every single thing. That alone makes it highly unfavorable.Text,Image, components, and these are highly likely to be very inflexibleI favor this approach:
Tolga and I discussed about Puppeteer on AWS Lambda. We think it is feasible.