# Class: TemplateEngine

## vertx-web-js/template_engine~ TemplateEngine

#### new TemplateEngine()

A template engine uses a specific template and the data in a routing context to render a resource into a buffer.

Concrete implementations exist for several well-known template engines.

Source:
  - vertx-web-js/template_engine.js, line 33

### Methods

#### isCachingEnabled() → {boolean}

Returns true if the template engine caches template files. If false, then template files are freshly loaded each time they are used.

Source:
  - vertx-web-js/template_engine.js, line 79

##### Returns:

True if template files are cached; otherwise, false.

Type
  boolean

#### render(context, templateDirectory, templateFileName, handler)

Render the template

NOTE if you call method directly (i.e. not using TemplateHandler) make sure that templateFileName is sanitized via Utils#normalizePath

##### Parameters:

Name | Type | Description
--- | --- | ---
`context` | RoutingContext | the routing context
`templateDirectory` | string | the template directory to use
`templateFileName` | string | the relative template file name to use
`handler` | function | the handler that will be called with a result containing the buffer or a failure.

Source:
  - vertx-web-js/template_engine.js, line 50