Locomotive.js + swig.js
To marry locomotive and swig just edit:
//file: config/environments/all.js
var express = require('express')
, poweredBy = require('connect-powered-by')
, util = require('util')
, cons = require('consolidate')
, swig = require('swig');
// ...
// Configure application settings.
this._routes._app.express.engine('.html',cons.swig);
swig.init({
root: __dirname + '/../../app/views',
allowErrors: true
});
this.set('views', __dirname + '/../../app/views');
this.set('view engine', 'html');
here this.routes.app.express will get as instance of express where we will set a view engine for express.
also don't forget to edit development.js to disable caching
var express = require('express')
, swig = require('swig');
module.exports = function() {
swig.init({
root: __dirname + '/../../app/views',
allowErrors: true,
cache: false
});
Written by Pavel Egorov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Swig
Authors
rebyn
1.695K
egorovpavel
1.056K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#