Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::Template::Error (The asset "favicon/site.webmanifest" is not present in the asset pipeline.) #497

Open
simonsay opened this issue Jan 25, 2024 · 2 comments

Comments

@simonsay
Copy link

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.

1: <link rel="apple-touch-icon" sizes="180x180" href="<%= asset_path 'favicon/apple-touch-icon.png' %>">
2: <link rel="icon" type="image/png" sizes="32x32" href="<%= asset_path 'favicon/favicon-32x32.png' %>">
3: <link rel="icon" type="image/png" sizes="16x16" href="<%= asset_path 'favicon/favicon-16x16.png' %>">
4: <link rel="manifest" href="<%= asset_path 'favicon/site.webmanifest' %>">
5: <link rel="mask-icon" href="<%= asset_path 'favicon/safari-pinned-tab.svg' %>" color="#5bbad5">
6: <link rel="shortcut icon" href="<%= asset_path 'favicon/favicon.ico' %>">
 7: <meta name="apple-mobile-web-app-title" content="SteadiCamTony">

app/views/application/_favicon.html.erb:4
app/views/layouts/application.html.erb:9

_favicon.html.erb:

application.html.erb:

<title>SteadiCamTony</title> <%= csrf_meta_tags %> <%= csp_meta_tag %> <%= render 'application/favicon' %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
<%= image_tag('IMG_3718.png', width: 1834, height: 1372, id: "bgd") %> <%= yield %>
@n-at-han-k
Copy link

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: RealFaviconGenerator/rails_real_favicon#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

@joaomarceloods
Copy link

If you're using Rails 7 you also need to add these two to manifest.js:

//= link favicon/site.webmanifest
//= link favicon/browserconfig.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants