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. doT is a really solid piece of software engineering (I didn’t create it) that is rarely updated exactly for this reason. It took me years to grasp how it works even though it’s only 140 lines of code, it looks like magic. I used it in my other projects (e.g. ajv) as the smallest, fastest and most functional (all three!) templating engine ever made, that is particularly useful in all code generation scenarios where manipulating AST is overkill. doT allows arbitrary JavaScript code in templates, making it one of the most flexible and powerful templating engines. It means that doT security model assumes that you only use trusted templates and you don't use any user input as any part of the template, as otherwise it can lead to code injection.

Features

  • It ignores sub-directories
  • Template files can have multiple extensions at the same time
  • Files with .def extension can be included in other files via {{#def.name}}
  • Files with .dot extension are compiled into functions with the same name and can be accessed as renderer.filename
  • Files with .jst extension are compiled into .js files
  • All inline defines defined in the .jst file are compiled into separate functions and are available via _render.filename.definename

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow doT

doT Web Site

You Might Also Like
Our Free Plans just got better! | Auth0 by Okta Icon
Our Free Plans just got better! | Auth0 by Okta

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your secuirty. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of doT!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Database Engines Servers, JavaScript Admin Templates

Registered

2021-11-23