Skip to content

Instantly share code, notes, and snippets.

@chrisenytc
Last active September 3, 2016 02:12
Show Gist options
  • Save chrisenytc/13f8ccd1323694a6b1dd to your computer and use it in GitHub Desktop.
Save chrisenytc/13f8ccd1323694a6b1dd to your computer and use it in GitHub Desktop.
Example of use swig template engine
var App = require('express')(),
swig = require('swig');
//Swig
swig.setDefaults({
cache: 'memory'
});
//assign the template engine to .html files
App.engine('html', swig.renderFile);
//set .html as the default extension
App.set('view engine', 'html');
//Set views path, template engine and default layout
App.set('views', 'viewsfolderhere');
App.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment