{"id":14967733,"url":"https://github.com/ladjs/cache-pug-templates","last_synced_at":"2025-10-25T21:31:54.308Z","repository":{"id":25122154,"uuid":"103235453","full_name":"ladjs/cache-pug-templates","owner":"ladjs","description":"Cache Pug templates for Lad/Koa/Express/Connect with Redis","archived":false,"fork":false,"pushed_at":"2023-12-06T23:14:49.000Z","size":551,"stargazers_count":26,"open_issues_count":2,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-31T10:51:10.788Z","etag":null,"topics":["app","cache","caching","connect","deploy","deployment","engine","engines","express","jade","koa","lad","listen","post","pug","redis","template","templates","templating","views"],"latest_commit_sha":null,"homepage":"https://lad.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ladjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-12T07:10:48.000Z","updated_at":"2023-11-15T02:10:55.000Z","dependencies_parsed_at":"2024-06-19T02:49:05.052Z","dependency_job_id":"155bd3c5-2e6e-4f42-8a8e-9a15f5ecedb8","html_url":"https://github.com/ladjs/cache-pug-templates","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":0.05769230769230771,"last_synced_commit":"32917752dddce6b26f4b3e781ea4c16879ac7262"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcache-pug-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcache-pug-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcache-pug-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcache-pug-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladjs","download_url":"https://codeload.github.com/ladjs/cache-pug-templates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238212424,"owners_count":19434955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","cache","caching","connect","deploy","deployment","engine","engines","express","jade","koa","lad","listen","post","pug","redis","template","templates","templating","views"],"created_at":"2024-09-24T13:38:31.929Z","updated_at":"2025-10-25T21:31:48.993Z","avatar_url":"https://github.com/ladjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cache-pug-templates\n\n[![build status](https://img.shields.io/travis/ladjs/cache-pug-templates.svg)](https://travis-ci.org/ladjs/cache-pug-templates)\n[![code coverage](https://img.shields.io/codecov/c/github/ladjs/cache-pug-templates.svg)](https://codecov.io/gh/ladjs/cache-pug-templates)\n[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)\n[![license](https://img.shields.io/github/license/ladjs/cache-pug-templates.svg)](\u003c\u003e)\n\n\u003e Cache [Pug][] templates for [Lad][]/[Koa][]/[Express][]/[Connect][].\n\n\n## Table of Contents\n\n* [Install](#install)\n* [Usage](#usage)\n  * [Basic](#basic)\n  * [Koa](#koa)\n  * [Express](#express)\n* [Options](#options)\n* [Debugging](#debugging)\n* [Contributors](#contributors)\n* [License](#license)\n\n\n## Install\n\n[npm][]:\n\n```sh\nnpm install cache-pug-templates\n```\n\n[yarn][]:\n\n```sh\nyarn add cache-pug-templates\n```\n\n\n## Usage\n\n### Basic\n\n```js\nconst path = require('path');\nconst CachePugTemplates = require('cache-pug-templates');\n\nconst views = path.join(__dirname, 'views');\n\nconst cache = new CachePugTemplates({ views });\ncache.start();\n```\n\n### Koa\n\n```js\nconst path = require('path');\nconst Koa = require('koa');\nconst CachePugTemplates = require('cache-pug-templates');\n\nconst app = new Koa();\n\n// optional (e.g. if you want to cache in non-production)\n// app.cache = true;\n\n// note that koa requires us to specify a\n// path name for the views directory\nconst views = path.join(__dirname, 'views');\n\napp.listen(3000, () =\u003e {\n  const cache = new CachePugTemplates({ app, views });\n  cache.start();\n});\n```\n\n### Express\n\n```js\nconst path = require('path');\nconst express = require('express');\nconst CachePugTemplates = require('cache-pug-templates');\n\nconst app = express();\n\n// optional (by default express defaults to `./views`)\n// app.set('views', path.join(__dirname, 'views'));\n\napp.set('view engine', 'pug');\n\napp.listen(3000, () =\u003e {\n  const cache = new CachePugTemplates({ app, views });\n  cache.start();\n});\n```\n\n\n## Options\n\n* `app` (Object) - an instance of Koa, Express, or Connect\n* `views` (String or Array) - a file directory path (or an Array of file directory paths) (if you pass an Express app instance as the `app` option, this will be automatically populated to your applications `views` configuration option via `app.get('views')`)\n* `logger` (Object) - a logger, defaults to `console` (we recommend using [Cabin][] for your logger)\n* `callback` (Function) - defaults to `false` (no operation), but if a function is provided then it will be invoked with two arguments, `file` (String) and `template` (Function)\n* `cache` (Boolean) - defaults to `true`, whether or not to cache templates automatically if `cache.start()` is called (useful if you are writing tests or have a custom approach using `callback` function)\n* `concurrency` (Number) - number of concurrent files that can be cached per `interval` in parallel (defaults to `1`)\n* `interval` (Number) - duration of time in (milliseconds) to limit concurrency for (e.g. `1 cached file every 1000ms` is the default), this value's default is `1000`\n\n\n## Debugging\n\nIf you want to check what the cache state is at anytime:\n\n```js\nconst pug = require('pug');\n\n// ...\n\n// get everything:\nconsole.log('pug.cache', pug.cache);\n\n// just get the file names:\nconsole.log('pug cached files', Object.keys(pug.cache));\n```\n\n\n## Contributors\n\n| Name           | Website                    |\n| -------------- | -------------------------- |\n| **Nick Baugh** | \u003chttp://niftylettuce.com/\u003e |\n\n\n## License\n\n[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)\n\n\n## \n\n[npm]: https://www.npmjs.com/\n\n[yarn]: https://yarnpkg.com/\n\n[pug]: https://pugjs.org\n\n[lad]: https://lad.js.org\n\n[koa]: http://koajs.com\n\n[express]: https://expressjs.com/\n\n[connect]: https://github.com/senchalabs/connect\n\n[cabin]: https://cabinjs.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fcache-pug-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladjs%2Fcache-pug-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fcache-pug-templates/lists"}