Created in search of the fastest and concise JavaScript templating function with emphasis on performance under V8 and nodejs. It shows great performance for both nodejs and browsers.
doT.js is fast, small and has no dependencies.
See jsperf benchmarks for an equal playground (encodes HTML values) comparison.
- custom delimiters
- runtime evaluation
- runtime interpolation
- compile-time evaluation
- partials support
- conditionals support
- array iterator
- encoding
- control whitespace - strip or preserve
- streaming friendly
- use it as logic-less or with logic, it is up to you
- ! coffeescript block
- ! comment
- ! object iterator
I created this fork for two reasons:
- doT templates are hard as heck to debug.
- No comment feature.
To get meaningful errors, set dot.templateSettings
{ append: false, strip: false }
Comments
{{-- This is a comment }}
CoffeeScript blocks
{{`cs
a = it?.prop || 'default'
}}
Object iterator
{{. it.fruits :value :key }}
{{= key}} = {{= value}}
{{.}}
- doT is an open source component of http://bebedo.com
- doT is licensed under the MIT License. (See LICENSE-DOT)