Utility for caching Pug templates in web frameworks like Express, Koa, and Connect. v2.0.3 is the latest stable release (last updated 2020). It batches template compilation to avoid overhead on first request. Alternatives like pug's built-in caching or webpack-based approaches offer more integration, but this package provides explicit control over batch caching for Lad/Koa/Express/Connect apps.
npm install cache-pug-templatesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: create a cache instance with views path and start caching.
Use `views` instead of `directory` in options.
Use `concurrency` and `interval` options to limit rate or use `callback` to manually select files.
Use require() instead of import.
npm install cache-pug-templates pug
Use const CachePugTemplates = require('cache-pug-templates')Pass a valid directory path or array of paths in `views` option.