Hogan.js is a 2.5k JS templating engine developed at Twitter. Use it as a part of your asset packager to compile templates ahead of time or include it in your browser to handle dynamic templates. If you're developing with Node.js, just use NPM to add the Hogan package. Hogan.js was developed against the mustache test suite, so everything that holds true for templates is also the case for hogan.js. That means you get variables, sections, lambdas, partials, filters, and everything else you've come to expect from mustache templating, only much, much faster. Use hogan.compile() to precompile your templates into vanilla JS. It's best to serve your templates precompiled whenever you can (rather than the raw templates), as parsing is the most time consuming operation. Once compiled, call the render() method with a context and optional partials object. If supplying partials, you can compile them ahead of time, or pass string templates.

Features

  • Hogan compiles templates to HoganTemplate objects
  • Hogan is fast, try it on your workload
  • Hogan has separate scanning, parsing and code generation phases
  • Add new features without touching the scanner at all
  • Hogan.js is a compiler for the Mustache templating language
  • Hogan exposes scan and parse methods

Project Samples

Project Activity

See All Activity >

Categories

Compilers, Languages

License

Apache License V2.0

Follow Hogan.js

Hogan.js Web Site

Other Useful Business Software
Auth0 for AI Agents now in GA Icon
Auth0 for AI Agents now in GA

Ready to implement AI with confidence (without sacrificing security)?

Connect your AI agents to apps and data more securely, give users control over the actions AI agents can perform and the data they can access, and enable human confirmation for critical agent actions.
Start building today
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Hogan.js!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Compilers, JavaScript Languages Software

Registered

2021-10-20