-
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs updates—adds a documentation page for each individual template e…
…ngine.
- Loading branch information
Showing
12 changed files
with
341 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# EJS | ||
|
||
| Eleventy Short Name | File Extension | NPM Package | | ||
| ------------------- | -------------- | ------------------------------------------ | | ||
| `ejs` | `.ejs` | [`ejs`](https://www.npmjs.com/package/ejs) | | ||
|
||
You can override a `.ejs` file’s template engine. Read more at [Changing a Template’s Rendering Engine](/docs/engines.md). | ||
|
||
## Set your own Library instance | ||
|
||
_New in Eleventy `v0.3.0`:_ As an escape mechanism for advanced usage, pass in your own instance of the EJS library using the Configuration API. | ||
|
||
```js | ||
module.exports = function(eleventyConfig) { | ||
let ejs = require("ejs"); | ||
eleventyConfig.setLibrary("ejs", ejs); | ||
}; | ||
``` | ||
|
||
## Compile/Render Options | ||
|
||
_New in Eleventy `v0.3.0`:_ See “Options” on the [EJS home page](https://ejs.co/). | ||
|
||
``` | ||
module.exports = function(eleventyConfig) { | ||
eleventyConfig.setEjsOptions({ | ||
// use <? ?> instead of <% %> | ||
delimiter: "?" | ||
}); | ||
}; | ||
``` | ||
|
||
## Supported Features | ||
|
||
| Feature | Syntax | | ||
| ----------------------------------- | --------------------------------------------------------------------------------- | | ||
| ✅ Include (Preprocessor Directive) | `<% include /user/show %>` looks for `_includes/user/show.ejs` | | ||
| ✅ Include (pass in Data) | `<%- include('/user/show', {user: 'Ava'}) %>` looks for `_includes/user/show.ejs` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# HAML | ||
|
||
| Eleventy Short Name | File Extension | NPM Package | | ||
| ------------------- | -------------- | -------------- | | ||
| `haml` | `.haml` | [`haml.js`](c) | | ||
|
||
You can override a `.haml` file’s template engine. Read more at [Changing a Template’s Rendering Engine](/docs/engines.md). | ||
|
||
## Set your own Library instance | ||
|
||
_New in Eleventy `v0.3.0`:_ As an escape mechanism for advanced usage, pass in your own instance of the HAML library using the Configuration API. | ||
|
||
```js | ||
module.exports = function(eleventyConfig) { | ||
let haml = require("hamljs"); | ||
eleventyConfig.setLibrary("haml", haml); | ||
}; | ||
``` | ||
|
||
## Supported Features | ||
|
||
| Feature | Syntax | | ||
| -------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | ||
| <!-- | _TODO_ Filters | | | ||
| _TODO_ [Eleventy Universal Filters](/docs/filters.md#built-in-universal-filters) | `:filterName some text` (see `eleventyConfig.addFilter` documentation) | | ||
|
||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Handlebars | ||
|
||
| Eleventy Short Name | File Extension | NPM Package | | ||
| ------------------- | -------------- | ---------------------------------------------------------- | | ||
| `hbs` | `.hbs` | [`handlebars.js`](https://github.com/wycats/handlebars.js) | | ||
|
||
You can override a `.hbs` file’s template engine. Read more at [Changing a Template’s Rendering Engine](/docs/engines.md). | ||
|
||
## Set your own Library instance | ||
|
||
_New in Eleventy `v0.3.0`:_ As an escape mechanism for advanced usage, pass in your own instance of the Handlebars library using the Configuration API. | ||
|
||
```js | ||
module.exports = function(eleventyConfig) { | ||
let handlebars = require("handlebars"); | ||
eleventyConfig.setLibrary("hbs", handlebars); | ||
}; | ||
``` | ||
|
||
## Supported Features | ||
|
||
| Feature | Syntax | | ||
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | ||
| ✅ Partials | `{{> user}}` looks for `_includes/user.hbs` | | ||
| ✅ Helpers | `{{ helperName myObject }}` Handlebars calls them Helpers, but Eleventy calls them filters. Read more about [filters](/docs/filters.md) | | ||
| ✅ [Eleventy Universal Filters](/docs/filters.md#built-in-universal-filters) | `{{ filterName myObject }}` (see `eleventyConfig.addFilter` documentation) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# HTML | ||
|
||
| Eleventy Short Name | File Extension | NPM Package | | ||
| ------------------- | -------------- | ----------- | | ||
| `html` | `.html` | N/A | | ||
|
||
HTML files can be optionally pre-processed with an additional template engine. This can be configured on a per-template basis or globally. Read more at [Changing a Template’s Rendering Engine](/docs/engines.md). | ||
|
||
⚠️ Careful with this template type when using the same `--input` and `--output` directory (this is not the default). Please read the [Common Pitfalls documentation](/docs/pitfalls.md#same-input-output). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# JavaScript Template Literals | ||
|
||
| Eleventy Short Name | File Extension | NPM Package | | ||
| ------------------- | -------------- | ----------- | | ||
| `jstl` | `.jstl` | N/A | | ||
|
||
You can override a `.jstl` file’s template engine. Read more at [Changing a Template’s Rendering Engine](/docs/engines.md). | ||
|
||
Read more about [JavaScript Template Literals on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals). | ||
|
||
Tagged templates are not yet supported. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Liquid | ||
|
||
| Eleventy Short Name | File Extension | NPM Package | | ||
| ------------------- | -------------- | ---------------------------------------------------- | | ||
| `liquid` | `.liquid` | [`liquidjs`](https://www.npmjs.com/package/liquidjs) | | ||
|
||
You can override a `.liquid` file’s template engine. Read more at [Changing a Template’s Rendering Engine](/docs/engines.md). | ||
|
||
## Library Options | ||
|
||
### Defaults | ||
|
||
Rather than constantly fixing outdated documentation, [find `getLiquidOptions` in `Liquid.js`](https://github.com/11ty/eleventy/blob/master/src/Engines/Liquid.js). These options are different than the [default `liquidjs` options](https://github.com/harttle/liquidjs#options). | ||
|
||
### Use your own options | ||
|
||
_New in Eleventy `v0.2.15`:_ It’s recommended to use the Configuration API to set override the default options above. | ||
|
||
```js | ||
module.exports = function(eleventyConfig) { | ||
eleventyConfig.setLiquidOptions({ | ||
dynamicPartials: true | ||
}); | ||
}; | ||
``` | ||
|
||
#### Set your own Library instance | ||
|
||
_New in Eleventy `v0.3.0`:_ As an escape mechanism for advanced usage, pass in your own instance of the Liquid library using the Configuration API. See [all `liquidjs` options](https://github.com/harttle/liquidjs#options). | ||
|
||
⚠️ Not compatible with `setLiquidOptions` above—this method will ignore any configuration set there. | ||
|
||
```js | ||
module.exports = function(eleventyConfig) { | ||
let liquidJs = require("liquidjs"); | ||
let options = { | ||
extname: ".liquid", | ||
dynamicPartials: true, | ||
root: ["_includes"] | ||
}; | ||
|
||
eleventyConfig.setLibrary("liquid", liquidJs(options)); | ||
}; | ||
``` | ||
|
||
## Supported Features | ||
|
||
| Feature | Syntax | | ||
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | ||
| ✅ Include | `{% include 'user' %}` looks for `_includes/user.liquid` | | ||
| ✅ Include (pass in Data) | `{% include 'user' with 'Ava' %}` | | ||
| ✅ Include (pass in Data) | `{% include 'user', user1: 'Ava', user2: 'Bill' %}` | | ||
| ✅ Custom Filters | `{{ name \| upper }}` (see `eleventyConfig.addLiquidFilter` documentation) | | ||
| ✅ [Eleventy Universal Filters](/docs/filters.md#built-in-universal-filters) | `{% name \| filterName %}` (see `eleventyConfig.addFilter` documentation) | | ||
| ✅ Custom Tags | `{% upper name %}` (see `eleventyConfig.addLiquidTag` documentation) | |
Oops, something went wrong.