express-hbs-helpers
v0.3.1
Published
Handlebars helpers for Express 3
Downloads
4
Readme
Handlebars helpers for Express 3
View helpers for handlebars engine. Work well with Express 3.
How to use with JavaScript
var engine = require('express-hbs');
var express = require('express');
var app = express();
app.configure(function() {
app.engine('hbs', engine.express3);
app.set('view engine', 'hbs');
app.set('helpers', engine.handlebars.helpers);
});
var helpers = require('express-hbs-helpers').helpers;
helpers(app, engine);
Or with CoffeeScript
engine = require 'express-hbs'
express = require 'express'
app = express()
app.configure ->
app.engine 'hbs', engine.express3
app.set 'view engine', 'hbs'
app.set 'helpers', engine.handlebars.helpers
{helpers} = require 'express-hbs-helpers'
helpers app, engine
Список хелперов:
- helper_date
- helper_datetime
- helper_year
- helper_plural
- helper_striptags
- helper_htmlescape
- helper_urlencode
- helper_money
- helper_length
- helper_wrap
Options:
helper_date (date, options)
- humane boolean default: false
- html boolean default: false
helper_datetime (date, options)
- humane boolean default: false
- html boolean default: false
helper_plural (count, options)
- words array
helper_wrap (text, options)
- size number default: 40