<commit_before>---
title: Engines
collection: docs
category: api
---

## Engines API

### .engine

Register the given template engine callback `fn` as `ext`.

**Example**

```js
app.engine('hbs', require('engine-handlebars'));
```

**Params**

* `ext` **{String}** File extension to use.
* `fn` **{Function|Object}**: Engine function or object with a `.render` method.
* `options` **{Object}**
* `returns` **{Object}**: Returns the assemble instance for chaining

Template engines in Assemble are used to render views. More specifically:

* `view.content`: Any text or markup language.

* `layouts` Layouts used when generating web pages.  The path of the layout file will be passed to the engine's `renderFile()` function.

By default Assemble will `require()` the engine based on the file extension.
For example if you try to render a "foo.jade" file Assemble will invoke the
following internally:

```js
app.engine('jade', require('jade'));
```

The module is expected to export a `.renderFile` function, or, for
compatibility with Express, an `__express` function.
<commit_msg>minor edits to engines docs, still wip<commit_after>---
title: Engines
collection: docs
category: api
---

## Engines API

### .engine

Register the given template engine `callback` function as `ext`:

```js
app.engine(ext, callback);
```

**Example**

```js
app.engine('hbs', require('engine-handlebars'));
```

**Params**

* `ext` **{String}** File extension to use.
* `fn` **{Function|Object}**: Engine function or object with a `.render` method.
* `options` **{Object}**
* `returns` **{Object}**: Returns the assemble instance for chaining


## How engines work

Template engines in Assemble are used to render views. More specifically:

* `view.content`: The `content` property in views is rendered. This can be any text or markup language.
* `layouts` Layouts used when generating web pages.  The path of the layout file will be passed to the engine's `renderFile()` function.

By default Assemble will `require()` the engine based on the file extension.
For example if you try to render a "foo.jade" file Assemble will invoke the
following internally:

```js
app.engine('jade', require('jade'));
```

The module is expected to export a `.renderFile` function, or, for
compatibility with Express, an `__express` function.

{'fraction_non_alphanumeric': 0.13382416630576008, 'fraction_numerical': 0.0, 'mean_word_length': 4.833333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2095981', 'n_tokens_mistral': 690, 'n_tokens_neox': 657, 'n_words': 294}