Skip to content

Instantly share code, notes, and snippets.

@raws
Created February 6, 2013 02:37
Show Gist options
  • Select an option

  • Save raws/4719762 to your computer and use it in GitHub Desktop.

Select an option

Save raws/4719762 to your computer and use it in GitHub Desktop.
Precompiled static error pages written in Haml using Rails 3's asset pipeline
Rails.application.assets.register_engine '.haml', Tilt::HamlTemplate
config.assets.register_mime_type 'text/html', '.html'
config.assets.paths << Rails.root.join('app', 'views', 'errors')
config.assets.precompile += %w(404.html 500.html)
config.exceptions_app = ActionDispatch::PublicExceptions.new(Rails.root.join('public', 'assets'))
@esposito

Copy link
Copy Markdown

Did you get this to work with the Rails 4.1 assets pipeline? My 404 and 500 pages get precompiled with a assets hash in their filename. Therefore ActionDispatch::PublicExceptions cannot find them (it looks for 500.html instead of 500-some_hashtag.html). So now I move these files after asset precompilation. It would be nice though if that would not be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment