Socket
Socket
Sign inDemoInstall

exphbs

Package Overview
Dependencies
79
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    exphbs

A Handlebars view engine for Express 4.x/3.x, with Node.js and io.js support


Version published
Weekly downloads
173
decreased by-54.95%
Maintainers
1
Install size
4.88 MB
Created
Weekly downloads
 

Readme

Source

exphbs Build Status

A Handlebars view engine for Express.

Node.js 9.5.0Node.js 8.9.4Node.js 7.10.1Node.js 6.12.3Node.js 5.12.0
Express 4
Express 3

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

Keywords

FAQs

Last updated on 03 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc