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

Upgrade to ejs ^3.0 or dynamic includes #47

Open
SamBroner opened this issue May 22, 2020 · 2 comments
Open

Upgrade to ejs ^3.0 or dynamic includes #47

SamBroner opened this issue May 22, 2020 · 2 comments

Comments

@SamBroner
Copy link

I'm attempting to upgrade this loader to ejs 3.0 to make dynamic includes easier.

I have a few paths I'm attempting here:

  1. Rebuild this with ejs 3.0. I'm running into an issue with the includes function itself. I believe I'm in the wrong scope for the template function of ejs.

  2. Do dynamic includes using require or some other existing JS infra

I think the issue may ultimately have to do with how webpack-html-plugin is handling templates, but I'd love some guidance.

@SamBroner
Copy link
Author

After some review, I think require is the easiest way to solve this for me.

However, I did find this caveat on the EJS readme I missed before: https://github.com/mde/ejs#caveats

I need to provide my own fn to do includes here. Seems reasonable.

@DanielBailey-web
Copy link

You can use include without quotes on your pathname and it seems to work.

<%- include pathname_without_quotes %>

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

No branches or pull requests

2 participants