Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom handlebars helpers #25

Open
Jacquesjh opened this issue Feb 6, 2024 · 1 comment
Open

Add custom handlebars helpers #25

Jacquesjh opened this issue Feb 6, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Jacquesjh
Copy link

Is your feature request related to a problem? Please describe.

When I upload my .zip with an index.html and an index.js, it does not uses the helpers that I made on the index.js.

Describe the solution you'd like

I would like to pass an .js file in the zip with the Handlebars helper that I need in my index.html and them being loaded when compiling.

Describe alternatives you've considered

Right now I had to edit the source of the cloud function, at lib/load_template.ts, to include my custom helpers. This is a really wacky solution because when I will have to edit it again to replicate it in other environments. At least this is a really fast solution.

The other solution woulb be to implement the whole html to pdf myself, which would take some time.

Additional context

No response

@Jacquesjh Jacquesjh added the enhancement New feature or request label Feb 6, 2024
@sassanh
Copy link
Member

sassanh commented Feb 6, 2024

The challenge is the custom helper may need some packages, its runtime may interfere with the pdf generator runtime, etc.
We may need to have two different solutions for simple helpers with no external requirement and helpers relying on external packages.
The former would be as easy as adding an optional HELPERS_PATH config like TEMPLATE_PATH config which keeps the path of a JS file containing bunch of Handlebars.registerHelper calls.
For the latter we may need a mechanism to bootstrap a package.json and run its entry, etc. I hope we can find a simpler solution to avoid unnecessary complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants