You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
565 B

  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