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

templates: Add readFile function, skips parsing contents as a template #5553

Merged
merged 2 commits into from
May 26, 2023

Conversation

asyncmeow
Copy link
Contributor

@asyncmeow asyncmeow commented May 22, 2023

This is a fix for the issue I created earlier, closes #5552. It's mostly a copy-paste of the include function, but skips the template parsing step to just return the body of the file unmodified.

@CLAassistant
Copy link

CLAassistant commented May 22, 2023

CLA assistant check
All committers have signed the CLA.

@francislavoie francislavoie changed the title Create an includeRaw template function to include a file without parsing it as a template templates: Add includeRaw function, skips parsing contents as a template May 22, 2023
@francislavoie francislavoie added the feature ⚙️ New feature or request label May 22, 2023
@francislavoie francislavoie added this to the v2.7.0 milestone May 22, 2023
…ing it as a template.

Some formatting fixes
@asyncmeow
Copy link
Contributor Author

Fixed the formatting issues + squashed the two commits together

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, this LGTM. I'm just waiting to merge while I try to think of a better name than includeRaw if one exists. :) That's all.

@asyncmeow
Copy link
Contributor Author

Maybe includeText? Honestly I just did includeRaw since that's what someone mentioned in Discord and I'm not that good at naming 😅

@mholt
Copy link
Member

mholt commented May 23, 2023

Yeah that's alright. It's not bad, just seems like an afterthought (which it is).

What I should have done is named include eval and then include could be the un-evaluated includer. Sigh.

@francislavoie
Copy link
Member

Maybe like readFile or something?

@caddyserver caddyserver deleted a comment from crckrberries May 23, 2023
@mholt
Copy link
Member

mholt commented May 26, 2023

I like readFile -- let's do that!

@francislavoie francislavoie changed the title templates: Add includeRaw function, skips parsing contents as a template templates: Add readFile function, skips parsing contents as a template May 26, 2023
@francislavoie
Copy link
Member

I pushed a commit to rename it, and I made some additional adjustments to the template docs cause I thought it wasn't super clear which functions would render in place and which would just return the buffer.

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM. (Don't mind the deleted comment; I was thrown off, not realizing that docs for other actions were edited -- I'm not sure why though.) (Edit: D'oh, just now seeing Francis' comment. Sigh.)

I think we can merge this 😃 Thanks for the contribution!

@mholt mholt merged commit 31d75ac into caddyserver:master May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Template function to include file without parsing that file as a template (ie. includeRaw)
4 participants