![]() If you want to check what the cache state is at anytime: const pug = require('pug') Ĭonsole.log('pug cached files', Object.keys(pug. This page is powered by a knowledgeable community that helps you make an informed decision. ![]() This way you have control on having a completely static template or just some partial contents so you can isolate and make static a specific partial with heavy queries. 'Easy to read, powerful mixins' is the primary reason people pick pug (Jade) over the competition. You can compile any template into static HTML simply by using the renderstatic() function in place of any rendertemplate() PHP function or any PUG’s include into you views. 1 cached file every 1000ms is the default), this value's default is 1000 pug (Jade), Vue.js, and Handlebars.js are probably your best bets out of the 32 options considered. interval (Number) - duration of time in (milliseconds) to limit concurrency for (e.g.concurrency (Number) - number of concurrent files that can be cached per interval in parallel (defaults to 1).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).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).logger (Object) - a logger, defaults to console (we recommend using Cabin for your logger).The view is still re-rendered with every request even when the cache is on. Note: The view engine cache does not cache the contents of the template’s output, only the underlying template itself. 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')) Create a Pug template file named index.pug in the views directory, with the following content: html head title title body h1 message Then.app (Object) - an instance of Koa, Express, or Connect.Usage Basic const path = require('path') Ĭonst CachePugTemplates = require('cache-pug-templates') Ĭonst views = path.join(_dirname, 'views') Ĭonst cache = new CachePugTemplates() Cache Pug templates for Lad/ Koa/ Express/ Connect.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |