An engine munger for express apps.
Lead Maintainer: Aria Stewart
A template engine munging library. It looks for appropriate template consolidation library for specified view engine and includes i18n and specialization in the workflow.
Note: If you use specialization features, you must use dustjs before 2.6.0.
Localization of included content tags for a specified locale. Currently supported only for dust templating engine and internally uses the module localizr for translating content tags included in the templates
Ability to switch a specific template with another based on a rule set specified in the app config. The actual rule parsing is done using the module karka and can be extended and used in any templating engine and not dust. All engine-munger does is includes a specialization map with the list of key value pairs using the karka module.
_specialization :originalTemplate : <mappedTemplate>
var engine-munger = require'engine-munger'app = require'express';appengine'dust' engine-munger'dust'settings config;appengine'js' engine-munger'js'settings config;
If you are using kraken-js 1.0 along with engine-munger, the kraken generator will automatically set this all up for you. But if you want to use this with a stand alone express app with dust as templating engine, you can specify as follows:
var settings = cache: falseconfig ='views': 'public/templates''view engine': 'dust''i18n':'fallback': 'en-US''contentPath': 'locales'specialization:'jekyll':is: 'hyde'when:'whoAmI': 'badGuy';
To run tests:$ npm testTo run coverage$ npm run-script coverTo run lint$ npm run-script lint