C
Chad Thomson
Guest
I'll take a swing at it. I assume you're talking about this module: consolidate GitHub - tj/consolidate.js: Template engine consolidation library for node.js The short version, Consolidate.js: wraps template engines making them ExpressJS compatible caches the generated output -- standard ExpressJS only caches the template file itself There may be more aspects to it, but those are the headline features I discovered. The author of the module does a good job documenting the use of the module, but doesn't really explain the "use-case" -- the " why " to it -- nor are there demonstrations comparing scenarios where it is used vs where it is not. To answer that, and hopefully your question, I did some digging and found these points useful. Using template engines with Express "Express-compliant template engines such as Jade and Pug export a function named __express(filePath, options, callback), which is called by the res.render() function to render the template code. Some template engines do not follow this convention. The Consolidate.js library follows this convention by mapping all of the popular Node.js template engines, and therefore works seamlessly within Express." Some template engines may have been developed without ExpressJS in-mind. ConsolidateJS wraps those engines and makes them ExpressJS 3.X compatible. Also on that page: "Note: The view engine cache does not cache the contents of the template’s output, only the underlying template itself. The view is still re-rendered with every request even when the cache is on." Consolidate.js will cache the rendered output, too. Hope that helps somewhat.
Continue reading...
Continue reading...