node-html-to-image icon indicating copy to clipboard operation
node-html-to-image copied to clipboard

Should Handlebars be a dependency?

Open bentorkington opened this issue 4 years ago • 4 comments

Since not all users will necessarily use templating, and those that do can simply pass the output from Handlebars (or potentially some other HTML template library that might better suit their needs), should Handlebars really be a hard dependency for the package?

bentorkington avatar Jul 15 '20 05:07 bentorkington

Hi @bentorkington 👋,

I made this package for my own purpose I often use handlebars to make images so it removes boilerplate for me. It could be an optional dependency. If the user provides the content option without installing handlebars it could throw an error. What do you think of it?

frinyvonnick avatar Jul 20 '20 16:07 frinyvonnick

Hi @frinyvonnick 😀

Thanks for making your package available. This could work, another alternative might be to make two packages:

  1. one package with no Handlebars dependency which only performs image generation
  2. another package which is a wrapper for package 1 and uses Handlebars. Perhaps other templating engines like Nunjucks or Liquid would eventually get similar wrappers.

This would achieve the separation of concerns neatly while avoiding the error condition of not having Handlebars installed.

bentorkington avatar Jul 21 '20 22:07 bentorkington

I can't make a separate package easily because of the multiple image generation. Can't figure out how to split this up while keeping this feature 🤔 Do you have an idea?

frinyvonnick avatar Jul 22 '20 07:07 frinyvonnick

I'll get a PR in when I have time

bentorkington avatar Jul 29 '20 21:07 bentorkington