express-hogan.js icon indicating copy to clipboard operation
express-hogan.js copied to clipboard

update this for express 3.0

Open fat opened this issue 13 years ago • 6 comments

Currently tj merged in hjs - which seems way worse then what you have here (doesn't seem to support partials, etc.).

Would be cool to update this plugin and get it merged instead

fat avatar Jun 28 '12 06:06 fat

Could you be more specific? What is "tj"? Hjs means hogan.js? Add some link etc. Thanks.

dundee avatar Jun 28 '12 07:06 dundee

sure sorry - tj == visionmedia (the author of express).

He's working on releasing version 3 of express - and has merged in a plugin called hjs (https://github.com/nullfirm/hjs).

Here's the first relevant commit in express: https://github.com/visionmedia/express/commit/18083f0c13b07705a906beda881628f5991264f8#L0R25

The hjs plugin doesn't appear to support a lot of things (one of which is partials). I was thinking it would be cool to update your plugin to work with the new version of express (slightly different syntax).

If you don't have time, that's cool too. Just thought i'd point it out.

fat avatar Jun 28 '12 08:06 fat

Ok, I will try to do so.

dundee avatar Jun 29 '12 15:06 dundee

Hi, support for Express 3 should be done. Do you think I should contact tj?

dundee avatar Jul 18 '12 17:07 dundee

Didn't work for me. Here's the test script :

var express = require('express');
var expressHogan = require('express-hogan.js'); // require('express-hogan.js')

var app = express.createServer();

app.configure(function() {
app.set('views', __dirname + '/views');
app.engine('hjs', expressHogan.renderFile);
});

app.get('/', function(req, res) {
res.locals = {
title: 'Express test',
message: 'using Hogan templating system'
};
return res.render('index.hjs');
});

app.listen(3000);

console.log('Express server listening on port 3000');

And the error output :

/node_modules/express/lib/application.js:172
if ('function' != typeof fn) throw new Error('callback function required');
                                 ^
Error: callback function required

My express version is 3.0.5

vinyll avatar Dec 28 '12 21:12 vinyll

Works for me. Are you using master of this library? I just published it to npmjs as version 0.3.0 as well.

dundee avatar Jan 25 '13 16:01 dundee