We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Using HAML with Toto is quite easy.
1. Require ‘haml’ in your config.ru
2. Add the following snippet to your Toto::Server block:
set :to_html, lambda {|path, page, ctx| ::Haml::Engine.new(File.read("#{path}/#{page}.haml"), :format => :html5, :ugly => true).render(ctx) }
Note: the :ugly parameter prevents Haml from indenting pre blocks. It also gives better performance.
:ugly
pre
3. Set error codes to be rendered with HAML as well:
set :error do |code| ::Haml::Engine.new(File.read("templates/pages/#{code}.haml"), :format => :html5, :ugly => true).render(@context) end
You may be interested in this erb2haml converter.