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

Configuration Docs Do Not Reference addTemplateFormats API #1697

Open
naomiyaki opened this issue May 19, 2024 · 1 comment
Open

Configuration Docs Do Not Reference addTemplateFormats API #1697

naomiyaki opened this issue May 19, 2024 · 1 comment

Comments

@naomiyaki
Copy link

I wanted to add a couple of template formats to my build without effecting the defaults. Looks like there's a function that does just that, but it isn't in the docs anywhere!

eleventyConfig.setTemplateFormats("html,liquid,njk");

I couldn't find a precedent on this page for how an additional function would be added here, but if someone wants to provide guidance I'd be happy to write it up in a PR. Otherwise, go for it 💖

@Snapstromegon
Copy link
Member

Hi @naomiyaki, seems like you're correct and this is not yet documented.
Looking at the code (since I haven't used that function myself), it looks like it works like setTemplateFormats, but instead of replacing the existing template formats, it just adds them to the list.

So you'd call it as:

eleventyConfig.addTemplateFormats("myformat,other");
// or
eleventyConfig.addTemplateFormats(["myformat", "other"]);

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

No branches or pull requests

2 participants