Socket
Book a DemoInstallSign in
Socket

hbs-express-templ-shiv

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hbs-express-templ-shiv

Express 3.x removed layouts to favor templating systems handling them. This is a small shiv function to support layouts with handlebars.

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Handlebars/Express layout shiv

Express 3.x has removed layouts to favor templating systems handling for their own. This is a small shiv function to make rendering into a generic template easier.

Use

Install on command line

npm install --save hbs-express-templ-shiv

Example Express server

app.js:

var express = require('express')
  , handlebars = require('consolidate').handlebars
  , render = require('hbs-express-templ-shiv')

app.set('views', __dirname)
app.set('view engine', 'hbs')
app.engine('hbs', handlebars)

// file to take layout from
// defaults to 'layout'
render.layout = 'myLayout' 

// name of place to put content in layout
// defaults to 'content' (duh)
render.content = 'myContent'

app.get('/', function (req, res) {
  render(res, 'index')
})

app.listen(3000)

myLayout.hbs:

<!DOCTYPE html>
<head>
  <title>ya think yer funny?</title>
</head>
<body>
  {{> myContent}}
</body>

index.hbs:

<h1>Hello, world!</h1>

Keywords

handlebars

FAQs

Package last updated on 26 Mar 2014

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.