How to use the swig.init function in swig

To help you get started, we’ve selected a few swig examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flockonus / gartsb / proofs / boiler / app.js View on Github external
var express = require('express')
  , routes = require('./routes')
  , http = require('http')
  , path = require('path')
  , swig = require('./config/consolidate-swig').swig
  , redis = require('redis')
  , C 



var app = express();

if ('development' == app.get('env')) {
	C = console.log
	app.set('config', JSON.parse( require('fs').readFileSync('./config/development.json', 'utf8') ) )
	require('swig').init({ cache: false, allowErrors: true, filters: {} })
	console.log('configuring DEV')
}

if ('production' == app.get('env')) {
	C = function(){}
  app.set('config', JSON.parse( require('fs').readFileSync('./config/production.json', 'utf8') ) )
  require('swig').init({ cache: true, allowErrors: false, filters: {} })
	console.log('configuring PROD')
}



app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.engine('html', swig);
	app.set('view engine', 'html');
github bigcompany / resources / swig / index.js View on Github external
swig.method('configure', function (options){
  var _swig = require('swig');
      _swig.init(options);
});
github bigcompany / resources / view / lib / engines / swig / index.js View on Github external
exports.init = function (options) {
  var swig = require('swig');
  swig.init(options);
};
github emre / swarm-host / swarm-host / app.js View on Github external
/**
 * Module dependencies.
 */

var express = require('express')
  , routes = require('./routes')
  , http = require('http')
  , path = require('path')
  , stat = require('./stat')
  , config = require('./config')
  , swig = require('./swigger').swig

var app = express();
var enable_debug = true;

require('swig').init({ cache: true, allowErrors: false, filters: {} })

app.set('host', config.APP_HOST);
app.set('port', config.APP_PORT);
app.set('views', __dirname + '/views');

app.engine('html', swig);
app.set('view engine', 'html');
app.set('view options', { layout: false });

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')));
github lepture / nico / lib / engines / swig.js View on Github external
function init() {
  if (isInitSwig) return;
  store = getEnv();

  swig.init({
    autoescape: false,
    cache: false,
    allowErrors: true,
    encoding: option.get('encoding'),
    filters: store.filters,
    root: store.roots,
    tzOffset: option.get('tzOffset', 0)
  });

  isInitSwig = true;
}

swig

A simple, powerful, and extendable templating engine for node.js and browsers, similar to Django, Jinja2, and Twig.

MIT
Latest version published 10 years ago

Package Health Score

52 / 100
Full package analysis