0.0.1-alpha.3 • Published 8 years ago
temply-express v0.0.1-alpha.3
temply-express
Temply's HTML template engine for Express.js
How to use it
Easy peasy.
Configure temply-express
as a view engine in your Express.js app.js
file:
var templyEngineFactory = require('temply-express');
var pluginsRepository = [path.join(__dirname, 'plugins/data'), path.join(__dirname, 'plugins/render')];
var templyEngine = templyEngineFactory(pluginsRepository);
app.engine('html', templyEngine);
// view engine setup
app.set('views', path.join(__dirname, 'templates'));
app.set('view engine', 'html');
Now use it in a route
:
router.get('/', function(req, res, next) {
res.render('index.html');
});
That will look up templates/index.html
and call all plugins referenced in it.
In this example, plugins will be loaded from plugins/data
and plugins/render
.
The resulting HTML will be written to the HTTP response.
0.0.1-alpha.3
8 years ago
0.0.1-alpha.2
8 years ago