node.js - Handlebars SWAG library -
i'm new in handlebars , i'm trying use swag library custom helpers unsuccess. example try display in file.handlebars {{lowercase "bender should not allowed on tv"}} , error error: not find property 'lowercase' ran npm install swag
my app.js is:
var express = require('express') , http = require('http') , routes = require('./routes') , path = require('path') ,swag = require('swag') , handlebars = require('handlebars'); var app = express(); var engines = require('consolidate'); app.engine('handlebars', engines.handlebars); app.configure(function() { app.set('view engine', 'handlebars'); app.set('views', __dirname + '/views'); app.set('port', process.env.port || 3000); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyparser()); app.use(express.methodoverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); }); app.get('/dashboard', routes.getdashboard); http.createserver(app).listen(app.get('port'), function(){ console.log('express server listening on port ' + app.get('port')); });
thank in advance help
alcudia
i'm not 100% sure, guess consolidate
package returns it's own locale copy of handlebars. so, not handlebars required, , not global handlebars onto swag applied.
to schematise: require("handlebars") !== require("consolidate").handlebars
so, guess you'll need register swags helper on consolidate handlebars instance. (and there, checked swag code source , don't thinks that's possible atm)
Comments
Post a Comment