Question

I'm brand new to Rails. I installed the Zurb foundation front-end framework as described here: http://www.zurb.com/article/814/yetify-your-rails-new-foundation-gem-and-

When I open app/assets/stylesheets/application.css I find this auto-generated code:

/*
* This is a manifest file that'll automatically include all the stylesheets available in      this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require foundation
*= require_tree . 
*/

However, this line in my view

<%= stylesheet_link_tag    "application" %>

does not load the file zurb_foundation/app/assets/stylesheets/foundation/index.css I created:

couldn't find file 'foundation'
(in /Users/migu/railsapps/maneki1/app/assets/stylesheets/application.css:6)

How can I make it load the file and all CSS files I put under zurb_foundation/app/assets/stylesheets/foundation/? Thanks...

Was it helpful?

Solution

You will need to restart the webserver before Rails picks up the new assets from the zurb-foundation gem. Once restarted, it should just work.

Also, you can check the zurb-foundation assets are correctly found from the rails console. At the command prompt, enter "rails c", and then "Rails.application.config.assets.paths" (both commands minus the quotes). You should see something like:

=> ["/Users/MYUSER/appPath/app/assets/images", "/Users/MYUSER/appPath/app/assets/javascripts", "/Users/MYUSER/appPath/app/assets/stylesheets", "/Users/MYUSER/appPath/vendor/assets/stylesheets", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/jquery-rails-1.0.19/vendor/assets/javascripts", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/zurb-foundation-2.1.0/vendor/assets/images", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/zurb-foundation-2.1.0/vendor/assets/javascripts", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/zurb-foundation-2.1.0/vendor/assets/stylesheets"] 

Note you might need to do some extra work to get the assets deployed on production.

OTHER TIPS

Here is how I solve similar issue based on this thread https://github.com/zurb/foundation/issues/834 Added compass-rails gem in Gemfile:

group :assets do
  gem 'compass-rails'

Run:

bundle install

Dont' forget to restart the web-server and magic will happen.

You can add this directive to your application.css file:

 *= require_directory ./foundation

Or you can use the foundation-rails gem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top