1
0

assets.rake 565 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. def render_static_page(action, dest:, **opts)
  3. html = ApplicationController.render(action, opts)
  4. File.write(dest, html)
  5. end
  6. namespace :assets do
  7. desc 'Generate static pages'
  8. task generate_static_pages: :environment do
  9. render_static_page 'errors/500', layout: 'error', dest: Rails.root.join('public', 'assets', '500.html')
  10. end
  11. end
  12. if Rake::Task.task_defined?('assets:precompile')
  13. Rake::Task['assets:precompile'].enhance do
  14. Webpacker.manifest.refresh
  15. Rake::Task['assets:generate_static_pages'].invoke
  16. end
  17. end