Skip to content

express helper that caches all .jade files to memory on startup

Notifications You must be signed in to change notification settings

Tickaroo/express-pug-cache-helper

Repository files navigation

express-pug-cache-helper

npm version Build Status codecov.io

express helper that caches all .pug files to memory on startup

Install

$ npm install --save express-pug-cache-helper

Usage

Below is a example of usage.

var express = require('express');
var pugCacheHelper = require('express-pug-cache-helper');

var app = express();
var indexApp = express();

indexApp.set('view engine', 'pug');
indexApp.set('views', __dirname + '/templates');
indexApp.get('/home', function(req, res, next){
  res.render('show');
});

app.use(pugCacheHelper(adminApp), {force: true}); // <= important part
app.listen(3000);

API

pugCacheHelper(expressApp, options):

  • expressApp: express app, important: it needs to fire 'mount' event
  • options:
    • force: Forces express view cache setting to true (default undefined)
    • pugCompileOptions: Options object handed over to pug.compileFile (default {cache: true})
    • pugExt: Template file name extension (default '.pug')

Options

Use DEBUG=epch:cache to debug with debug.

About

express helper that caches all .jade files to memory on startup

Resources

Stars

Watchers

Forks

Packages

No packages published