I've been caught by this for at least the second time: haml views and CSS files not being found in a brand new Sinatra app. The configuration is (to me) somewhat obscure, so I'm documenting the fix here.
To get the views
and public
directories working properly, be sure to configure app_file
(set to nil
by default in Sinatra::Base
):
configure do
set :app_file, __FILE__
end
To get static files working properly, configure static
(set to false
by default in Sinatra::Base
):
configure do
set :app_file, __FILE__
set :static, true
end