Two (and several) ways:
Global
class MyApp < Sinatra::Base set :haml, :layout => false get '/reports' do haml :reports end end
Blacklisting
If the number of routes that do not require layouts is less, then this is the template:
class MyApp < Sinatra::Base get '/reports' do haml :reports, :layout => false end end
Whitelisting
If routes that don't need a layout.haml file layout.haml longer, however, Sinatra does not seem to support overriding the global declaration set :haml, :layout => false . I took the liberty of opening the issue for this function, since it seems reasonable enough (I hope you will not mind).
source share