Last Updated: February 25, 2016
·
1.052K
· egorovpavel

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
  });