StaticErrorPages
Quick'n Dirty static error pages generator for Rails
- Relies on
ApplicationController.renderer
to generate 404.html, 500.html, 503.html, 422.html during deploy - Adds a rake task
bundle exec rails assets:error_pages
and adds that toprecompile
for auto deployment.
This is a Rails Engine, and it provides some German language SLIM templates which should be copied over:
bundle exec rails g static_error_pages:copy
Afterwards, adjust the files in app/views/error_pages/*
, especially the layout file and include a minimalistic CSS for the error page.
Developing error pages
Currently, run the rake task after every change: rails assets:error_pages
and it will generate all files into public/*
Config
Rails initializer / application.rb / environments:
## add oder change list of files
Rails.application.config.static_error_pages.pages = ["404.html", "500.html", "503.html", "422.html"]
## default layout file = layouts/error_pages
Rails.application.config.static_error_pages = "error_pages/layout"
Webpacker
If you naively link the javascript/stylesheet pack tag, they might end of empty. Depending on your setup, you can try:
-
- activate
extract_css: true
inconfig/webpacker.yml
- activate
-
- use the
inline_pack_tag
helper function to fully inline css/js webpack packs
- use the