Open simonsay opened 7 months ago
Please note that this issue is posted on the incorrect Repo. Correct one is: https://github.com/RealFaviconGenerator/rails_real_favicon
I’m answering this as I ended up here from google first. If you’re using Rails 7 then this issue is solved using the instructions here: https://github.com/RealFaviconGenerator/rails_real_favicon/issues/46
Delete the config/initializers/web_app_manifest.rb
file and you should be good to go.
Or just comment it out
#Rails.application.config.assets.configure do |env|
#mime_type = 'application/manifest+json'
#extensions = ['.webmanifest']
#if Sprockets::VERSION.to_i >= 4
#extensions << '.webmanifest.erb'
#env.register_preprocessor(mime_type, Sprockets::ERBProcessor)
#end
#env.register_mime_type(mime_type, extensions: extensions)
#end
If you're using Rails 7 you also need to add these two to manifest.js
:
//= link favicon/site.webmanifest
//= link favicon/browserconfig.xml
Rails 7.1.3 on Ubuntu 20.04 LTS, nginx 1.18.0-0ubuntu1.4, libnginx-mod-http-passenger/focal,now 1:6.0.20-1~focal1 amd64 [installed] web_app_manifest.rb: Rails.application.config.assets.configure do |env| mime_type = 'application/manifest+json' extensions = ['.webmanifest']
if Sprockets::VERSION.to_i >= 4 extensions << '.webmanifest.erb'
env.register_preprocessor(mime_type, Sprockets::ERBProcessor) end
env.register_mime_type(mime_type, extensions: extensions) end
Runs ok on local machine with bin/dev, on server Processing by HighVoltage::PagesController#show as HTML Parameters: {"id"=>"home"} Rendered layout layouts/application.html.erb (Duration: 1.0ms | Allocations: 443) Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.0ms | Allocations: 762)
ActionView::Template::Error (The asset "favicon/site.webmanifest" is not present in the asset pipeline.
app/views/application/_favicon.html.erb:4 app/views/layouts/application.html.erb:9
_favicon.html.erb:
application.html.erb: <!DOCTYPE html>