Wednesday, April 22, 2009

Liquid and Sinatra

Liquid is a templating language used when you need safety for your templates. I was planning to build a CMS and Liquid fit the needs of a templating library really well. I also like Sinatra for its simplicity. Unfortunately, Sinatra did not have support for liquid yet so I went ahead and built one. You can get that from my liquid topic branch on github.

There are few significant changes that you need to care about when using liquid instead of ERB or HAML.


  • None of the local members or class members declared will be available in your template

  • The locals hash is respected even for the layout.

  • You have to use {{ content }} in your layouts, instead of yielding.



And finally a "hello world" sinatra app with liquid.



Do let me know if you like it.

No comments: