Thoughts, information and reflections about technology

Artisteer templates with Ruby on Rails – Header and graphics not showing – solution

I was creating a Ruby on Rails site and used Artisteer 4.3 to generate the template.

Even though I included the precompile directives in assets.rb, I was still not seeing the images for the header and some other images. I tried a rake assets:clobber / rake assets:precompile but that didn’t help.

The problem was that the references in style.css to images were in the form of

content:url(‘images/blockbullets.png’);

 
The solution was to remove the images/ prefix so that the references appeared as:
content:url(‘blockbullets.png’);
 
After I made the changes, about 40 in all, I did a  rake assets:precompile and the header images were showing as expected.
I also added the following to assets.rb


Rails.application.config.assets.compile = true                                    #for Production
Rails.application. config.assets.precompile = [‘*.js’, ‘*.css’, ‘*.css.erb’]      #for Production
Rails.application.config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif]        #for Production
Rails.application.config.assets.precompile += %w(script.js)
Rails.application.config.assets.precompile += %w(script.responsive.js)
Rails.application.config.assets.precompile += %w( style.css )
Rails.application.config.assets.precompile += %w( style.responsive.css )
Rails.application.config.assets.precompile += %w( style.ie7.css )

as well as adding the following to application.js

//= require script
//= require script.responsive

Now the template is working as expected

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact me
Archives
Categories
Amazon Disclosure

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.