1

I found a nice template online and want to use it for my rails app homepage. I decided to use the high voltage gem and read through its readme. I managed to get the routing right but I could not find the appropriate path/folder for the numerous asset (css, js, svgs and sass) files which come inside the template zip file, and which obviously make it look nice.

I tried putting them into the assets folder of my rails app, which got some of the "features" working, but svgs and images didn't display... and it screwed my existing pages. Reading through the Rails documentation I then tried storing the template assets into the vendor folder, which did not work either.

Where should I store the assets for my template-inspired homepage for them not to screw the appearance of my normal/app pages? Which paths should I use in my html to call them?

  • What is your setup: rails version, css and javascript frameworks you have installed, bare boned Rails application or upgrading existing one? – R Milushev Nov 25 '14 at 09:36
  • Yep, forgot to give all these precious details. Bare boned Rails 4.4 app, only Foundation installed. – Arnaud Bubu Dec 01 '14 at 15:42

1 Answers1

0

If you have troubles with images, take a look at image references in the template source. You can see a reference to image like this :

background-image: url('images/top-1280.svg')

which would not serve this image in Rails.

I would suggest to find and replace all the image references in your css (or scss) files.

Try this :

background-image: url(image-path('top-1280.svg'));

which is the proper way for Rails 4.

The differences: in Rials you have a helper method "image-path" and you do not prefix the image file with directory name.

It is important to check in your "app/assets/stylesheets/appilcation.css" if there are lines like:

 *= require_tree .
 *= require_self

Now about Font Awesome : I see that in this theme you are about to use Font Awesome. I would suggest using the gem for Rails:

In your Gemfile:

gem 'font-awesome-sass'

I think the theme you have chosen is very nice. Thank you for sharing it, it will be useful for my current project.

R Milushev
  • 4,295
  • 3
  • 27
  • 35