Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions en/guide/using-template-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ To render template files, set the following [application setting properties](/{{
This defaults to the `views` directory in the application root directory.
* `view engine`, the template engine to use. For example, to use the Pug template engine: `app.set('view engine', 'pug')`.

### Manual Setup (Without Generator)

If you are not using the Express generator, you must manually configure the engine to ensure Express can interface with it properly. While engines like Pug work out of the box, others (like Handlebars) require a specific wrapper package.

For example, to use Handlebars manually:

1. Install the `express-handlebars` package: `$ npm install express-handlebars`
2. Configure it in your `app.js`:

```js
const { engine } = require('express-handlebars')
app.engine('handlebars', engine())
app.set('view engine', 'handlebars')
```
Then install the corresponding template engine npm package; for example to install Pug:

```bash
Expand Down