Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Sep 27, 2024
1 parent 234abc3 commit 103a853
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Specify which types of templates should be transformed.
| _Default_ | `html,liquid,ejs,md,hbs,mustache,haml,pug,njk,11ty.js` |
| _Valid Options_ | Array of [template engine short names](/docs/languages/) |
| _Command Line Override_ | `--formats` _(accepts a comma separated string)_ |
| _Configuration API_ | `setTemplateFormats` {% addedin "0.2.14" %} |
| _Configuration API_ | `setTemplateFormats` {% addedin "0.2.14" %} and `addTemplateFormats` {% addedin "0.11.0" %} |

{% callout "info" %}{% addedin "0.9.0" %} <strong>Case sensitivity</strong>: File extensions should be considered case insensitive, cross-platform. While macOS already behaves this way (by default), other operating systems require additional Eleventy code to enable this behavior.{% endcallout %}

Expand All @@ -267,10 +267,15 @@ There are many [different shapes of configuration file](/docs/config-shapes.md).

{% set codeContent %}
export default function (eleventyConfig) {
// Reset to this value
eleventyConfig.setTemplateFormats("html,liquid,njk");

// Additive to existing
eleventyConfig.addTemplateFormats("pug,haml");

// Or:
// eleventyConfig.setTemplateFormats([ "html", "liquid", "njk" ]);
// eleventyConfig.addTemplateFormats([ "pug", "haml" ]);
};
{% endset %}
{% include "snippets/configDefinition.njk" %}
Expand Down
5 changes: 5 additions & 0 deletions src/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ A hypothetical `template.md` in the current directory would be rendered to `_sit
# Use only a subset of template types
npx @11ty/eleventy --formats=md,html,ejs

# Don’t process any formats
npx @11ty/eleventy --formats=

# Find out the most up-to-date list of commands (there are more)
npx @11ty/eleventy --help
{% endset %}
Expand All @@ -55,6 +58,8 @@ npx @11ty/eleventy --help
<div id="usage-formats-yarn" role="tabpanel">{% highlight "bash" %}{{ usageFormatsCode | packageManagerCodeTransform("yarn") }}{% endhighlight %}</div>
</seven-minute-tabs>

* The default for `--formats=` changed in {{ "3.0.0-alpha.7" | coerceVersion }} from an alias of `*` to an empty set.

### Re-run Eleventy when you save

{% set usageServeCode %}
Expand Down

0 comments on commit 103a853

Please sign in to comment.