Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For anyone's convenience, I adopted Richard's solution in my project and created a simple ruby script that replaces asset links in the static HTML error / maintenance pages. It is deliberatery NOT a rake task so that it is as fast as possible. It has no Rails depenency anyway, other than that it has to be run from the rails root directory.</p> <pre><code>#!/usr/bin/env ruby require 'yaml' GLOBS = %w(public/errors_source/*.html) MANIFEST = "public/assets/manifest.yml" manifest = YAML::load(File.open(MANIFEST)) GLOBS.each do |glob| Dir.glob(glob).each do |file| next unless File.file?(file) contents = File.read(file) manifest.each do |asset, compiled_asset| contents.gsub!(asset, "/assets/#{compiled_asset}") end File.open(file.gsub('errors_source/',''), 'w') do |outfile| outfile.write(contents) end end end </code></pre> <p>The script expects the static HTML error/maintenance pages to live under the <code>errors_source</code> directory and copies them (with assets replaced for their hashed versions) to the rails root directory. </p> <p>A sample maintenance page then may look like this (notice the CSS asset link and logo image - these assets are simply shared with the main rails code):</p> <pre><code>&lt;html&gt; &lt;head&gt; ... &lt;link href="application.css" media="screen" rel="stylesheet" type="text/css"/&gt; &lt;/head&gt; &lt;body&gt; ... &lt;a href="/"&gt;&lt;img src="logo.png" width="161" height="61"/&gt;&lt;/a&gt; ... &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload