fixulate
fixulate

Reputation: 371

HTML5 CSS and Rails template

I am using the free HTML5 template at the following URL:

http://html5up.net/eventually

I can not get the background images working from the main.js file. (bg01.jpg, bg02.jpg, bg03.jpg).

How should I reference these image files using rails asset pipeline assumign they are in /assets/ ?

The CSS and layout is working fine, my includes currently look like this:

<%= stylesheet_link_tag    'main', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'main', 'data-turbolinks-track' => true %>

The above is to include the CSS and JS that comes with the eventually template, but I don't get the 3 rotating images in the background.

Any helps would be great.

Thanks

Upvotes: 0

Views: 200

Answers (1)

The Fabio
The Fabio

Reputation: 6250

Yes... You have to use the asset pipeline.

You can reference the images by adding the following to the image address reference:

<%= asset_path 'bg01.jpg' %>

for this tag to work in a css file, you have to change the file name adding a .erb to its end. It would became yourFile.css.erb or yourfile.scss.erb

update

your code goes like this:

images: {
        'images/bg01.jpg': 'center',
        'images/bg02.jpg': 'center',
        'images/bg03.jpg': 'center'
        },

should be changed to

images: {
        '<%= asset_path 'bg01.jpg' %>': 'center',
        '<%= asset_path 'bg02.jpg' %>': 'center',
        '<%= asset_path 'bg03.jpg' %>': 'center'
        },

Upvotes: 3

Related Questions