Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Explain caching better in #114

wants to merge 1 commit into from

3 participants


No description provided.


was just looking for exactly this. thanks! :clap:



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 23, 2013
  1. @jschall
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 8 deletions.
  1. +2 −8
@@ -72,14 +72,8 @@ cons[name]('views/page.html', { user: 'tobi' }, function(err, html){
## Caching
To enable caching simply pass `{ cache: true }`. Engines _may_ use this option to cache things reading the file contents, compiled `Function`s etc. Engines which do _not_ support this may simply ignore it. All engines that consolidate.js implements I/O for will cache the file contents, ideal for production environments.
-var cons = require('consolidate');
-cons.swig('views/page.html', { user: 'tobi' }, function(err, html){
- if (err) throw err;
- console.log(html);
+ When using consolidate directly: `cons.swig('views/page.html', { user: 'tobi', cache:true },callback);`
+ Using Express 3 or higher: `app.locals.cache = true` or set NODE_ENV to 'production' and Express will do this for you.
## Express 3.x example
Something went wrong with that request. Please try again.