Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

connect-handlebars

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-handlebars

Connect middleware for Handlebars

latest
Source
npmnpm
Version
4.0.0
Version published
Maintainers
1
Created
Source

build status

Introduction

connect-handlebars is Connect middleware that pre-compiles handlebars to JS. Since express is built on top of Connect, connect-handlebars will allow you to compile handlebars templates with expressjs.

Installation

npm install connect-handlebars

Usage

Example in express:

var connect_handlebars = require('connect-handlebars')
app = require('express').createServer()

app.use("/templates.js", connect_handlebars(__dirname + "/path/to/templates"));

app.listen(80);

The middleware builder takes two arguments source and options

  • source: The absolute path to the root directory of .handlebars files to compile.
  • options: Object of options with the following keys
    • exts: String|Array of file extensions to pre-compille. (default: ['hbs','handlebars'])
    • exts_re: RegExp instance for matching file extensions you want to match. Overrides exts
    • recursive: bool indicating if sub directories are searched (default: true)
    • encoding: String indicating the encoding to use (default: utf8)
    • cache: boolean indicating if you want to use caching (default: true)

Testing

npm test

Specs for the Jasmine tests are in ./specs

Keywords

Handlebars

FAQs

Package last updated on 23 Aug 2017

Did you know?

Socket

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