twitter-bootstrap-rails icon indicating copy to clipboard operation
twitter-bootstrap-rails copied to clipboard

Problem with Rails 5.1.4 and apple-touch-icons asset pipeline

Open Janfred opened this issue 7 years ago • 7 comments

I've encountered problems with the default layout since I've upgraded to Rails 5.1.4

I see the following error:

ActionView::Template::Error (The asset "apple-touch-icon-144x144-precomposed.png" is not present in the asset pipeline.):
    11: 
    12:     <!-- For third-generation iPad with high-resolution Retina display: -->
    13:     <!-- Size should be 144 x 144 pixels -->
    14:     <%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
    15: 
    16:     <!-- For iPhone with high-resolution Retina display: -->
    17:     <!-- Size should be 114 x 114 pixels -->
  
app/views/layouts/application.html.erb:14:in `_app_views_layouts_application_html_erb__3925031818673559404_47451698147320'

I've setup the test app using this commands:

rails new BoostrapTest
cd BootstrapTest
rails generate bootstrap:install
rails generate bootstrap:layout
# Add //= require bootstrap in app/assets/javascript/application.js
# Add  *= bootstrap_and_overrides in app/assets/stylesheets/application.css
rails generate scaffold User username:string password:string
rails generate bootstrap:themed Users
rails s

And then go to http://localhost:3000/users

In Rails 5.0.X the same setup works but already shows a deprecation hint. (Don't know the exact version, could look for it if needed)

Janfred avatar Dec 26 '17 18:12 Janfred

It's a rails 5.1 change that is documented here https://github.com/rails/rails/issues/29535

you revert to the original behaviour by adding

Rails.application.config.assets.unknown_asset_fallback = true

to a file in config/initializers (like, say, config/initializers/assets.rb)

edit: I guess this solution isn't perfect since the log now shows

DEPRECATION WARNING: The asset "apple-touch-icon-114x114-precomposed.png" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.

Following that instructions and adding skip_pipeline: true to the favicon_link_tag entries in your layout also seem to work, and suppresses the deprecation warning.

boourns avatar Feb 18 '18 17:02 boourns

Since the behavior will be removed I guess it needs to be addressed. For the moment there should be at least some kind of documentation which adjustments have to be made when using this gem with Rails 5.

Janfred avatar Feb 20 '18 13:02 Janfred

try to create these PNGs files...

fagianijunior avatar Apr 19 '18 14:04 fagianijunior

Any progress on this issue? The issue still exists with the current version of this gem and rails 5.2.3.

Janfred avatar Aug 28 '19 10:08 Janfred

This is still a problem with Rails 6 :(

calebhaye avatar May 07 '20 15:05 calebhaye

any updates on this, still issue in rails 6 :( I am trying to learn each time I am learning new things i face new problems :(

khalilFrough avatar Jul 07 '20 11:07 khalilFrough

this problem still persists in rails 7

TrindadeF avatar Jun 03 '22 13:06 TrindadeF