Quick'n Dirty static error pages generator for Rails
- Relies on
ApplicationController.rendererto generate 404.html, 500.html, 503.html, 422.html during deploy - Adds a rake task
bundle exec rails assets:error_pagesand adds that toprecompilefor 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.
Currently, run the rake task after every change: rails assets:error_pages and it will generate all files into public/*
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"If you naively link the javascript/stylesheet pack tag, they might end of empty. Depending on your setup, you can try:
-
- activate
extract_css: trueinconfig/webpacker.yml
- activate
-
- use the
inline_pack_taghelper function to fully inline css/js webpack packs
- use the