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 JS functions for use within .pug files #6

Open
tycrek opened this issue Oct 12, 2023 · 0 comments
Open

Add custom JS functions for use within .pug files #6

tycrek opened this issue Oct 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@tycrek
Copy link
Owner

tycrek commented Oct 12, 2023

This idea is inspired by pug4j's Helpers.

This feature would allow users to pass a new option, functions, with which they provide JS files that are imported into Pug files.

Example

npx pagery --data=info.json functions=fetcher.js

The Pug file would be able to access these as follows:

body
    h1= data.info.title
    p= functions.fetcher(data.info.welcomePageUrl)

The JS files would have to include an exports.default. The function title would be the filename. You may also pass an exported class or Object.

@tycrek tycrek added the enhancement New feature or request label Oct 12, 2023
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

1 participant