{"_id":"@eligo-public/express-dot-engine","_rev":"6-598f345b62606689fac75da5ca579d83","name":"@eligo-public/express-dot-engine","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@eligo-public/express-dot-engine","version":"1.0.0","keywords":["express","doT","engine","template"],"author":{"name":"Dan Le Van"},"license":"MIT","_id":"@eligo-public/express-dot-engine@1.0.0","maintainers":[{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"}],"contributors":[{"url":"https://sturgess.co/","name":"CJ Sturgess","email":"cj@sturgess.co"},{"name":"Mihai Slobozeanu","email":"mihaislobozeanu@gmail.com"},{"name":"Paul Mihailescu"}],"homepage":"https://github.com/mihaislobozeanu/express-dot-engine","bugs":{"url":"git://github.com/mihaislobozeanu/express-dot-engine/issues"},"dist":{"shasum":"066ca23f8f45522870af79c12a34389b0bc1993f","tarball":"https://registry.npmjs.org/@eligo-public/express-dot-engine/-/express-dot-engine-1.0.0.tgz","fileCount":17,"integrity":"sha512-85QD1WyVMZUuXgaTFRwJSpAjKQAuwHnxoOQRQQk4B+CbCzLIExugeTrW6l0AL6wizFfeaGfwZtw/9H08q194CA==","signatures":[{"sig":"MEYCIQC6Isd3GywYSYkV78Mm3WE+ryBWCEsOYdLJ0lQPGjEYCAIhAKRezatfHwB85ZTFum6UKxW5ju0kus6dEYeziSypHAsw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46069},"main":"index.js","engines":{"node":">=8.0.0"},"gitHead":"887c99337d97f58833ee4bd1475ec0462416659f","scripts":{"test":"mocha"},"_npmUser":{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"},"repository":{"url":"git://github.com/mihaislobozeanu/express-dot-engine.git","type":"git"},"_npmVersion":"6.14.18","description":"Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)","directories":{},"_nodeVersion":"14.21.3","dependencies":{"lodash":"^4.17.21","js-yaml":"^4.1.0","@eligo-public/dot":"^1.0.0"},"engineStrict":true,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.7.0","should":"^13.2.0","express":"^4.18.2","mock-fs":"^5.2.0"},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/express-dot-engine_1.0.0_1733736655042_0.6675470585769803","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@eligo-public/express-dot-engine","version":"1.0.1","keywords":["express","doT","engine","template"],"author":{"name":"Dan Le Van"},"license":"MIT","_id":"@eligo-public/express-dot-engine@1.0.1","maintainers":[{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"}],"contributors":[{"url":"https://sturgess.co/","name":"CJ Sturgess","email":"cj@sturgess.co"},{"name":"Mihai Slobozeanu","email":"mihaislobozeanu@gmail.com"},{"name":"Paul Mihailescu"}],"homepage":"https://github.com/mihaislobozeanu/express-dot-engine","bugs":{"url":"git://github.com/mihaislobozeanu/express-dot-engine/issues"},"dist":{"shasum":"6d55ec10234ff0760e3163eec6a6eef80b2377c0","tarball":"https://registry.npmjs.org/@eligo-public/express-dot-engine/-/express-dot-engine-1.0.1.tgz","fileCount":17,"integrity":"sha512-P53F46wlqes50rneNaVEjnhkt3jqqu81uUSlykFuGaRrDp8IK55CT/K9p9AMlHbvcag5dWsvnHqObsYZqmD8MA==","signatures":[{"sig":"MEUCIGPo7qGtNXrX/6oGTdm3ByVpH8ok9s7CFtJVbVr1iGWWAiEAsPQvrrm95F8sY8dufGu2x9cI1DNGxCx0/O53RJGVI90=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46082},"main":"index.js","engines":{"node":">=8.0.0"},"gitHead":"4fef6360f42e452962e59d911332e16d059d84fa","scripts":{"test":"mocha"},"_npmUser":{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"},"repository":{"url":"git://github.com/mihaislobozeanu/express-dot-engine.git","type":"git"},"_npmVersion":"6.14.18","description":"Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)","directories":{},"_nodeVersion":"14.21.3","dependencies":{"lodash":"^4.17.21","js-yaml":"^4.1.0","@eligo-public/dot":"^1.0.0"},"engineStrict":true,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.7.0","should":"^13.2.0","express":"^4.21.2","mock-fs":"^5.2.0"},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/express-dot-engine_1.0.1_1734097353843_0.7550696713210765","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@eligo-public/express-dot-engine","version":"1.0.2","keywords":["express","doT","engine","template"],"author":{"name":"Dan Le Van"},"license":"MIT","_id":"@eligo-public/express-dot-engine@1.0.2","maintainers":[{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"}],"contributors":[{"url":"https://sturgess.co/","name":"CJ Sturgess","email":"cj@sturgess.co"},{"name":"Mihai Slobozeanu","email":"mihaislobozeanu@gmail.com"},{"name":"Paul Mihailescu"}],"homepage":"https://github.com/mihaislobozeanu/express-dot-engine","bugs":{"url":"git://github.com/mihaislobozeanu/express-dot-engine/issues"},"dist":{"shasum":"4fd6cec9104923431514b56b3f12be03c3a4efe5","tarball":"https://registry.npmjs.org/@eligo-public/express-dot-engine/-/express-dot-engine-1.0.2.tgz","fileCount":17,"integrity":"sha512-lqbXNADP357YLPVkQqNyJfIEFsKqsxkbRBLWcRhj1sY8vpyNGSNxo++qIIpl0Lxo8YgU5tZ0mtmiwVEy/IW0yA==","signatures":[{"sig":"MEUCIFRvTUDFKsPER16rS3Q5Z3h80Fd2CS7iV7fw02HrOQqkAiEAwgqJIMM0eLPsyiH6xQcpGFqDLzfTLHWsfhCtl8wwe/A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46993},"main":"index.js","engines":{"node":">=8.0.0"},"gitHead":"036fe29081832c16f4e3b83839da5a40de782a8c","scripts":{"test":"mocha"},"_npmUser":{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"},"repository":{"url":"git://github.com/mihaislobozeanu/express-dot-engine.git","type":"git"},"_npmVersion":"6.14.18","description":"Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)","directories":{},"_nodeVersion":"14.21.3","dependencies":{"lodash":"^4.17.21","js-yaml":"^4.1.0","@eligo-public/dot":"^1.0.0"},"engineStrict":true,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.7.0","should":"^13.2.0","express":"^4.21.2","mock-fs":"^5.2.0"},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/express-dot-engine_1.0.2_1734445849548_0.42379216018152466","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@eligo-public/express-dot-engine","version":"1.0.3","keywords":["express","doT","engine","template"],"author":{"name":"Dan Le Van"},"license":"MIT","_id":"@eligo-public/express-dot-engine@1.0.3","maintainers":[{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"}],"contributors":[{"url":"https://sturgess.co/","name":"CJ Sturgess","email":"cj@sturgess.co"},{"name":"Mihai Slobozeanu","email":"mihaislobozeanu@gmail.com"},{"name":"Paul Mihailescu"}],"homepage":"https://github.com/mihaislobozeanu/express-dot-engine","bugs":{"url":"git://github.com/mihaislobozeanu/express-dot-engine/issues"},"dist":{"shasum":"4d03dc43040e1fca144744fff0bf66a3cf4b70ed","tarball":"https://registry.npmjs.org/@eligo-public/express-dot-engine/-/express-dot-engine-1.0.3.tgz","fileCount":17,"integrity":"sha512-eVRc5ikid9OJml+CJ0P6oofEnqHhBUCdX3TIVaVY9efhAwhyxyf43fr6gpEr+Jy6AzXhubuw3nnV/s8ltftAqA==","signatures":[{"sig":"MEUCIDDxXJP3NIhMSA/ymjzfy3mv2LeAnYkBO6IbLi6gesxWAiEAzLOFIY5YSzJZ2Fsqb5b7+9XLuqvVJnojJydUVVf+5SE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47467},"main":"index.js","engines":{"node":">=8.0.0"},"gitHead":"bf2826ee96abb3aa3d2c12d922e10f1e5e107e8b","scripts":{"test":"mocha"},"_npmUser":{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"},"repository":{"url":"git://github.com/mihaislobozeanu/express-dot-engine.git","type":"git"},"_npmVersion":"6.14.18","description":"Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)","directories":{},"_nodeVersion":"14.21.3","dependencies":{"lodash":"^4.17.21","js-yaml":"^4.1.0","@eligo-public/dot":"^1.0.0"},"engineStrict":true,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.7.0","should":"^13.2.0","express":"^4.21.2","mock-fs":"^5.2.0"},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/express-dot-engine_1.0.3_1734510695539_0.9561307801853751","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@eligo-public/express-dot-engine","version":"1.0.4","keywords":["express","doT","engine","template"],"author":{"name":"Dan Le Van"},"license":"MIT","_id":"@eligo-public/express-dot-engine@1.0.4","maintainers":[{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"}],"contributors":[{"url":"https://sturgess.co/","name":"CJ Sturgess","email":"cj@sturgess.co"},{"name":"Mihai Slobozeanu","email":"mihaislobozeanu@gmail.com"},{"name":"Paul Mihailescu"}],"homepage":"https://github.com/mihaislobozeanu/express-dot-engine","bugs":{"url":"git://github.com/mihaislobozeanu/express-dot-engine/issues"},"dist":{"shasum":"9cb3054f1c271581a26da0e3fbe9cd5248affcca","tarball":"https://registry.npmjs.org/@eligo-public/express-dot-engine/-/express-dot-engine-1.0.4.tgz","fileCount":17,"integrity":"sha512-YyLY4Vm8ifTwPCcBlmWnwNqmSgL12d5LOkCwR4yPkqqJriM5TDZp3K+jw74qfUnME+vNbTRgYtt5bjirccBnUQ==","signatures":[{"sig":"MEYCIQCuwIvIiKRK8MxwJz/DkVmM/JAlLz04XO5F7Pl47Yh1qwIhAOuLydDKl4Cc5bSxT3Sw/XWOAWPNnuJoA+slOgzVzFSI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47744},"main":"index.js","engines":{"node":">=8.0.0"},"gitHead":"f5f1fe1bf5065b9f067b72c09c37319f6a07ad7b","scripts":{"test":"mocha"},"_npmUser":{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"},"repository":{"url":"git://github.com/mihaislobozeanu/express-dot-engine.git","type":"git"},"_npmVersion":"6.14.18","description":"Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)","directories":{},"_nodeVersion":"14.21.3","dependencies":{"lodash":"^4.17.21","js-yaml":"^4.1.0","@eligo-public/dot":"^1.0.0"},"engineStrict":true,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.7.0","should":"^13.2.0","express":"^4.21.2","mock-fs":"^5.2.0"},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/express-dot-engine_1.0.4_1734514376657_0.5364036917231554","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@eligo-public/express-dot-engine","version":"1.0.5","description":"Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)","author":{"name":"Dan Le Van"},"homepage":"https://github.com/mihaislobozeanu/express-dot-engine","keywords":["express","doT","engine","template"],"repository":{"type":"git","url":"git://github.com/mihaislobozeanu/express-dot-engine.git"},"bugs":{"url":"git://github.com/mihaislobozeanu/express-dot-engine/issues"},"contributors":[{"name":"CJ Sturgess","email":"cj@sturgess.co","url":"https://sturgess.co/"},{"name":"Mihai Slobozeanu","email":"mihaislobozeanu@gmail.com"},{"name":"Paul Mihailescu"}],"license":"MIT","main":"index.js","scripts":{"test":"mocha"},"engines":{"node":">=8.0.0"},"engineStrict":true,"dependencies":{"@eligo-public/dot":"^1.0.0","js-yaml":"^4.1.0","lodash":"^4.17.21"},"optionalDependencies":{},"devDependencies":{"express":"^4.21.2","mocha":"^10.7.0","mock-fs":"^5.2.0","should":"^13.2.0"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"gitHead":"72c930f3acef92b932668a4e5c032dd5c6df0b37","_id":"@eligo-public/express-dot-engine@1.0.5","_nodeVersion":"14.21.3","_npmVersion":"6.14.18","dist":{"integrity":"sha512-eBqq2QcU9HoI9N46jYOjK4iEQ4uohtACVvBSN85nGHcgzGJuPnMWdh7Citme57B5gVhQC4gm9fYhSsRJ+Ni/pg==","shasum":"4a3c0cfad3245b2ec02475bf28e43045337d23ef","tarball":"https://registry.npmjs.org/@eligo-public/express-dot-engine/-/express-dot-engine-1.0.5.tgz","fileCount":17,"unpackedSize":50840,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFnV6ESlKHLaIL8bpu32J8YfLi0MFLVoFM/vJGD+IIukAiBBnikyo6PcZz7swQJQClakx6AxQcykyx5KB03HnqZ6vQ=="}]},"_npmUser":{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"},"directories":{},"maintainers":[{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/express-dot-engine_1.0.5_1758890579990_0.705674969726156"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-09T09:30:54.959Z","modified":"2025-09-26T12:43:00.381Z","1.0.0":"2024-12-09T09:30:55.252Z","1.0.1":"2024-12-13T13:42:34.070Z","1.0.2":"2024-12-17T14:30:49.695Z","1.0.3":"2024-12-18T08:31:35.701Z","1.0.4":"2024-12-18T09:32:56.831Z","1.0.5":"2025-09-26T12:43:00.184Z"},"bugs":{"url":"git://github.com/mihaislobozeanu/express-dot-engine/issues"},"author":{"name":"Dan Le Van"},"license":"MIT","homepage":"https://github.com/mihaislobozeanu/express-dot-engine","keywords":["express","doT","engine","template"],"repository":{"type":"git","url":"git://github.com/mihaislobozeanu/express-dot-engine.git"},"description":"Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)","contributors":[{"name":"CJ Sturgess","email":"cj@sturgess.co","url":"https://sturgess.co/"},{"name":"Mihai Slobozeanu","email":"mihaislobozeanu@gmail.com"},{"name":"Paul Mihailescu"}],"maintainers":[{"name":"mihaislobozeanu","email":"mihai.slobozeanu@gmail.com"}],"readme":"# express-dot-engine\n\n[![GitHub version](https://badge.fury.io/gh/danlevan%2Fexpress-dot-engine.svg)](http://badge.fury.io/gh/danlevan%2Fexpress-dot-engine) [![npm version](https://badge.fury.io/js/express-dot-engine.svg)](http://badge.fury.io/js/express-dot-engine) [![Build Status](https://travis-ci.org/danlevan/express-dot-engine.svg)](https://travis-ci.org/danlevan/express-dot-engine)\n\n> Node.js engine using the ultra fast [doT](http://olado.github.io/doT/) templating with support for layouts, partials. It's friendly for front-end web libraries (Angular, Ember, Backbone...)\n\n## Important\n\nThe default settings of doT has been change to use `[[ ]]` instead of `{{ }}`. This is to support client side templates (Angular, Ember, ...). You can change it back by changing the Settings (see below).\n\n## Features\n\n- extremely fast ([see jsperf](http://jsperf.com/dom-vs-innerhtml-based-templating/998))\n- all the advantage of [doT](http://olado.github.io/doT/)\n- layout and partial support\n- uses `[[ ]]` by default, not clashing with `{{ }}` (Angular, Ember...)\n- custom helpers to your views\n- conditional, array iterators, custom delimiters...\n- use it as logic-less or with logic, it is up to you\n- use it also for your email (or anything) templates\n- automatic caching in production\n\n### Great for\n\n- √ Purists that wants html as their templates but with full access to javascript\n- √ Minimum server-side logic, passing server models to client-side frameworks like Angular, Ember, Backbone...\n- √ Clean and fast templating with support for layouts and partials\n- √ Email templating\n\n### Not so much for\n\n- Jade style lovers (http://jade-lang.com/)\n- Full blown templating with everything already coded for you (you can however provide any custom functions to your views)\n\n## Installation\n\nInstall with npm\n\n```sh\n$ npm install express-dot-engine --save\n```\n\nThen set the engine in express\n\n```javascript\nvar engine = require('express-dot-engine');\n...\n\napp.engine('dot', engine.__express);\napp.set('views', path.join(__dirname, './views'));\napp.set('view engine', 'dot');\n```\n\n## Settings\n\nBy default, the engine uses `[[ ]]` instead of `{{ }}` on the backend. This allows the use of front-end templating libraries that already use `{{ }}`.\n\n```\n[[ ]]     for evaluation\n[[= ]]    for interpolation\n[[! ]]    for interpolation with encoding\n[[# ]]    for compile-time evaluation/includes and partials\n[[## #]]  for compile-time defines\n[[? ]]    for conditionals\n[[~ ]]    for array iteration\n```\n\nIf you want to configure this you can change the exposed [doT settings](http://olado.github.io/doT/).\n\n```javascript\n// doT settings\nengine.settings.dot = {\n  evaluate:    /\\[\\[([\\s\\S]+?)\\]\\]/g,\n  interpolate: /\\[\\[=([\\s\\S]+?)\\]\\]/g,\n  encode:      /\\[\\[!([\\s\\S]+?)\\]\\]/g,\n  use:         /\\[\\[#([\\s\\S]+?)\\]\\]/g,\n  define:      /\\[\\[##\\s*([\\w\\.$]+)\\s*(\\:|=)([\\s\\S]+?)#\\]\\]/g,\n  conditional: /\\[\\[\\?(\\?)?\\s*([\\s\\S]*?)\\s*\\]\\]/g,\n  iterate:     /\\[\\[~\\s*(?:\\]\\]|([\\s\\S]+?)\\s*\\:\\s*([\\w$]+)\\s*(?:\\:\\s*([\\w$]+))?\\s*\\]\\])/g,\n  varname: 'layout, partial, locals, model',\n  strip: false,\n  append: true,\n  selfcontained: false,\n};\n```\n\n## Layout\n\nYou can specify the layout using [yaml](http://yaml.org/) and refer to the section as you would from a model.\n\nYou can also define any extra configurations (like a page title) that are inherited to the master.\n\n### Multiple section support\n\n`master.dot`\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>[[= layout.title ]]</title>\n  </head>\n  <body>\n    Hello from master.dot <br />\n    [[= layout.section1 ]] <br />\n    [[= layout.section2 ]]\n  </body>\n</html>\n```\n\n`index.dot`\n```html\n---\nlayout: master.dot\ntitle: Index page\n---\n\n[[##section1:\n  Hello from index.dot\n#]]\n\n[[##section2:\n  Hello from index.dot again\n#]]\n```\n\n#### Result\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>Index page</title>\n  </head>\n  <body>\n    Hello from master.dot <br />\n    Hello from index.dot <br />\n    Hello from index.dot again\n  </body>\n</html>\n```\n\n### Cascading layout support\n\n`CEO.dot`\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>[[= layout.title ]]</title>\n  </head>\n  <body>\n    Hello from CEO.dot <br />\n    [[= layout.section ]]\n  </body>\n</html>\n```\n\n`Boss.dot`\n\n```html\n---\nlayout: ceo.dot\n---\n\n[[##section:\n  Hello from Boss.dot <br />\n  [[= layout.section ]]\n#]]\n```\n\n`me.dot`\n\n```html\n---\nlayout: boss.dot\ntitle: Page title\n---\n\n[[##section:\n  Hello from me.dot\n#]]\n```\n\n#### Result\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>Boss page</title>\n  </head>\n  <body>\n    Hello from CEO.dot <br />\n    Hello from Boss.dot <br />\n    Hello from me.dot\n  </body>\n</html>\n```\n\n## Partials\n\nPartials are supported. The path is relative to the path of the current file.\n\n`index.dot`\n\n```html\n<div>\n  Message from partial: [[= partial('partials/hello.dot') ]]\n</div>\n```\n\n`partials/hello.dot`\n\n```html\n<span>Hello from partial</span>\n```\n\n### Result\n\n```html\n<div>\n  My partial says: <span>Hello from partial</span>\n</div>\n```\n\n## Server model\n\nIn your node application, the model passed to the engine will be available through `[[= model. ]]` in your template. Layouts and Partials also has access to the server models.\n\n`server.js`\n```javascript\napp.get('/', function(req, res){\n  res.render('index', { fromServer: 'Hello from server', });\n});\n```\n\n`view.dot`\n```html\n<div>\n  Server says: [[= model.fromServer ]]\n</div>\n```\n\n### Result\n\n```html\n<div>\n  Server says: Hello from server\n</div>\n```\n\n> Pro tip\n\nIf you want to make the whole model available in the client (to use in angular for example), you can render the model as JSON in a variable on the view.\n\n```html\n<script>\n  var model = [[= JSON.stringify(model) ]];\n</script>\n```\n\n## Helper\n\nYou can provide custom helper properties or methods to your views.\n\n`server`\n\n```javascript\nvar engine = require('express-dot-engine');\n\nengine.helper.myHelperProperty = 'Hello from server property helper';\n\nengine.helper.myHelperMethod = function(param) {\n\n  // you have access to the server model\n  var message = this.model.fromServer;\n\n  // .. any logic you want\n  return 'Server model: ' + message;\n}\n\n...\n\napp.get('/', function(req, res) {\n  res.render('helper/index', { fromServer: 'Hello from server', });\n});\n\n```\n\n`view`\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>Helper example</title>\n  </head>\n  <body>\n\n    model: [[= model.fromServer ]] <br />\n    helper property: [[# def.myHelperProperty ]] <br />\n    helper method: [[# def.myHelperMethod('Hello as a parameter') ]] <br />\n    helper in view: [[# def.helperInView ]]\n\n  </body>\n</html>\n\n[[##def.helperInView:\n  Hello from view helper ([[= model.fromServer ]])\n#]]\n\n```\n\n## Templating for email (or anything)\n\n- `render(filename, model, [callback])`\n- `renderString(templateStr, model, [callback])`\n\nThe callback is optional. The callback is in node style `function(err, result) {}`\n\nExample\n```javascript\nvar engine = require('express-dot-engine');\nvar model = { message: 'Hello', };\n\n// render from a file\nvar rendered = engine.render('path/to/file', model);\nemail.send('Subject', rendered);\n\n// async render from template string\nengine.renderString(\n  '<div>[[= model.message ]]</div>',\n  model,\n  function(err, rendered) {\n    email.send('Subject', rendered);\n  }\n);\n\n...\n```\n\n## Custom template provider\n\nYou can provide a custom template provider\n\n`server`\n\n```javascript\n\nfunction getTemplate(name, options, callback) {\n    var isAsync = callback && typeof callback === 'function',\n        template = '<div>custom template, you can store templates in the database</div>';\n    if(!isAsync){\n      return template;\n    }\n    callback(null, template);\n};\n\napp.get('/', function(req, res) {\n  res.render('helper/index', { getTemplate: getTemplate, });\n});\n\n```\n\n## Caching\n\nCaching is enabled when express is running in production via the 'view cache' variable in express. This is done automatically. If you want to enable cache in development, you can add this\n\n```javascript\napp.set('view cache', true);\n```\n\n## How to run the examples\n\n### 1. Install express-dot-engine\n\n```sh\n$ npm install express-dot-engine\n```\n\n### 2. Install express\n\n```sh\n$ npm install express\n```\n\n### 3. Run the example\n\n```sh\n$ node examples\n```\n\nOpen your browser to `http://localhost:2015`\n\n## Roadmap\n\n- Html minification in prod\n- Automatically remove server-side comments\n\n## License\n[MIT](LICENSE)\n","readmeFilename":"README.md"}