1.2.0 • Published 6 years ago

exphbs v1.2.0

Weekly downloads
191
License
MIT
Repository
github
Last release
6 years ago

exphbs Build Status

A Handlebars view engine for Express.

Features

Layouts:

  • Declaring layout with a render option or template comment ({{!< layout}})
  • Nested layouts with arbitrary depth

Partials:

  • Autoloading from defined directory (defaults to views/partials)
  • Namespaced partial names (based on relative paths)
  • Supports any file extension (defaults to hbs and html)
  • Dynamically applying changes during development

Helpers:

  • Autoloading from defined directory (defaults to views/helpers)

Block inheritance:

  • Defining named blocks in layouts then extend them in templates

Variables:

  • Defining @variables that can be accessed from any context in a template

Precompiling:

  • Templates and partials are precompiled and cached in production

Instances:

  • Creating a new instance of separate cache
  • Instantiating with user-provided Handlebars object

Getting started

Installation:

$ npm install exphbs

Registering view engine:

app.engine('hbs', require('exphbs'));
app.set('view engine', 'hbs');

Default directory structure:

.
├── app.js
└─┬ views/
  ├── index.hbs
  ├── helpers/
  ├── layouts/
  └── partials/

Example

Check out example directory for a complete example. You can play around with it on Runnable.

Docs

Tests

$ npm install
$ npm test

License

MIT

1.2.0

6 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago