Christoph Hochstrasser

What I like about Tilt

Tilt is a templating library for Ruby. It’s kind of an aggregator for templating engines — and I like it.

Tilt is a templating library for Ruby. It’s not an engine, but kind of an aggregator for templating engines and provides adapters to Erubis, Markdown and even for LESS and SASS. It’s kind of a “Meta” Templating Engine. Here is what I like about it.

Democratizes Writing of View Templates

Tilt supports many templating engines and you can choose the one you like the most. Want to use Markdown instead of Textile? Just use a .markdown file instead of a .textile. Or need some templates on the client side too? Use a JST or Mustache engine. The user can choose what he/she likes to use, or choose the best tool for the job.

You don’t have to reinvent the wheel

Need a view layer? Just plug it in. Frameworks can provide a great set of options for their users and at the same time they don’t have to reinvent the wheel.

It’s great for applications and libraries too, if you need support for multiple templating engines.

Who uses it?

  • Sinatra — a popular Ruby Microframework
  • Sprockets — powers the Rails Asset Pipeline
  • Gollum — runs the Github Wikis

What’s in there for PHP

Certainly something like this could be very useful for PHP Libraries/Frameworks, and as far as I know Zend_View 2 will go in that direction. I think though, that a framework-independent implementation would be even more useful (and I’m working in private on this, hint hint).


It certainly doesn’t fit everyone, though. If you plan to provide only support for one templating engine, then this is definitly going to be overhead. But it’s a good choice for everything, that needs support for multiple template engines (think Wikis, Blog Engines, Asset Pipelines) and for Frameworks, where you want a robust templating library and provide your users the choice to use whatever templating engine they want.