Open ThomasBush opened 10 years ago
I'm not quite sure this is an asset pipeline issue, it may just be the way you are referencing those files.
Instead of referencing them like this:
<%= favicon_link_tag 'images/apple-touch-icon-144x144-precomposed.png' ... %>
Try referencing them like this:
<%= favicon_link_tag 'assets/apple-touch-icon-144x144-precomposed.png' ... %>
or
<%= favicon_link_tag asset_path('apple-touch-icon-144x144-precomposed.png') ... %>
When using the asset pipeline, it doesn't matter which sub-folder items are in, they need to be referenced as /assets/file. So even if you have JavaScript files in the javascripts folder, CSS files in the stylesheets folder and images in the images folder, they will be reference like: /assets/my_javascript.js, /assets/my_stylesheet.css and /assets/my_image.png.
A little confusing at first, but Rails also provides you with the asset_path helper, which will find the asset you pass to it and will generate the correct asset path for you.
So, it does look like your assets are being pre-compiled, but Rails thinks you are referencing a different asset with the path you are using. Try these changes and see if that fixes the issue.
As far as the index.png files, I have no clue.
@thejbsmith, Thanks for the response.
I tried the following three attempts:
<%= favicon_link_tag 'assets/apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
<%= favicon_link_tag asset_path('apple-touch-icon-144x144-precomposed.png'), :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
<%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
The third being the way the favicon is rendered, which works even though all these images are in the exact same folder. Also I referenced the gems generators which had changed previously show the 'image/apple-tou...' and now just including the file itself as link below.
All attempts yield exact same results unfortunately. Any ideas?
Can you try hitting those images in the browser and see if any of the paths work that way? If so, then the image should be pre-compiled. If not, then there are definitely issues.
If you can hit the images in the browser, try inserting the correct html for a favicon in your layout directly instead of using the favicon_link_tag helper.
Which environment are you having issues with? Can you create a Gist of that environment config file as well?
I tried navigating to the following addresses, I assumed the first is supposed to be how the asset pipeline works according to your previous answer, but tried the other two in case I was wrong.
http://cms.hexarmor.com/assets/apple-touch-icon-144x144-precomposed.png http://cms.hexarmor.com/assets/images/apple-touch-icon-144x144-precomposed.png http://cms.hexarmor.com/apple-touch-icon-144x144-precomposed.png
None of the links yield any results.
It may be important to note that this doesn't work
<%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
While this is showing up.
<%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
And appears when I navigate here
http://cms.hexarmor.com/assets/favicon.ico
https://gist.github.com/ThomasBush/ee98f9c53c376ab9dbae
Development works fine, production is where my issue occurs. This is an internal tool, so there isn't a staging env as I assumed that was not necessary.
Looking at how the favicon_link_tag helper works, it looks like it inserts the "/assets/" part of the path for you. (View the source on the website and you can see this in action).
Can you do another deploy with verbose output and put the entire deploy output in a Gist?
Other than the apple-touch icons, are other images in the asset pipeline working when you deploy?
How do I set verbose output again? I have tried googling but only see scm_verbose option, is this what you meant?
Edit: I think I figured out. I ran this command, looks like what I usually see though:
cap production deploy -v
https://gist.github.com/ThomasBush/380ca2d6b37b2731cec6
All other imagery is served via RackSpace Cloudfiles, so the only image I can think of would be that ico image that is currently working.
I believe it is
cap production deploy --trace.
Try throwing another image into the assets/images folder, then try displaying that on the login screen (using the asset_path helper). This should easily work locally, but might help us debug production a little bit more.
Updated the gist with the corrected output https://gist.github.com/ThomasBush/380ca2d6b37b2731cec6
Also added a logo above the login using the asset_path as requested.
<img src="<%= asset_path('hexarmor-logo.png') %>" class="form-logo" alt="HexArmor Logo"/>
This works as can be seen at the following link.
http://cms.hexarmor.com/
I think we may be looking too in depth at this issue, so let's backtrack a bit.
Do you have the following images available in your assets/images folder? apple-touch-icon-144x144-precomposed.png apple-touch-icon-114x114-precomposed.png apple-touch-icon-72x72-precomposed.png apple-touch-icon-precomposed.png
Looking at the gem in depth a little more, it doesn't look like it actually provides these images for you. If the images are not there, then that is why you are getting the error. You can get sample images of all of those at http://html5boilerplate.com/.
You don't seem to be having any errors in your Capistrano deploy, but if those images are already in place, we'll probably have to dig a little deeper.
Yes, I have created these images, included the screen shot of my local file structure.
And if I ssh in and ls
the app/assets/images
folder
The different colors are because of file permissions, but the permission don't restrict viewing in anyway `-rw-rw-r--``. Also hexarmor-logo.png is working and it has the same perms as the other png files that are not currently working.
Try taking a look at http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets.
A few things to try based off of that article:
RAILS_ENV=production bundle exec rake assets:precompile
manually locally and on the server and see if you notice any differences, and if that is actually pre-compiling the images into the public/assets folder. (For more detail maybe try it with a --trace flag).load 'deploy/assets'
to your Capfile.With all of these, take a look at your manifest.yml file to see if it matches up with what you see in the public/assets directory. The last bullet will symlink your shared/assets folder to your public/assets folder. After those are linked, the contents will persist through deploys (although even without this, everything should be compiled on each deploy).
Try those out and let me know if anything works. If not, maybe it's time to grab another beer at Perrin.
Running RAILS_ENV=production bundle exec rake assets:precompile
worked fine locally. The asset directory is created, the files are created with the fingerprint, the manifest.yml is created, manifest contents and files(with fingerprint) have the same name, and I can open fingerprinted files to verify they are not corrupt.
I have tried to add load 'deploy/assets'
to my cap file, but this produces an error. cannot load such file -- deploy/assets
. Google searching doesn't prove much help, only solutions I can find are people rolling back to version 2.15 of Capistrano. I wonder if require 'capistrano/rails/assets'
took the place of deploy/assets and this is a typo on Rails guides? If so, this is already in my Capfile.
With help I got my app set up with Capistrano deployment and have been avoiding this error (commenting the offending lines out) to continue work on my app and testing in production. I get the following error in production.
I silence this error by commenting out the following favicon lines from my header partial.
Part of my cap deploy says it is running the precompile and if I look at the manifest, all these files are referenced, which I assume means they are precompiled. These files live in my
app/assets/images
folder. I am using twitter-bootstrap-rails gem and have followed every SO question I can find to no avail. Any help would be greatly appreciated, I have included my manifest below.manifest
I am also a bit confused about why these "index.png" files are in the manifest as those don't exist. So if someone could also explain that I would appreciate it. The asset pipeline has been one of the more confusing aspects in my learning experience with Rails.