<% @side_nav = "using" %>

<%= @page_title %>

We use Rails to develop our apps and Foundation makes things so much quicker. Start using Foundation in your Rails projects by following these instructions.


Adding Foundation to the Asset Pipeline

First you'll want to add the following gems to the assets group in your Gemfile like so:

<%= code_example " group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'uglifier', '>= 1.0.3' # Add Foundation Here gem 'zurb-foundation', '~> 4.0.0' end ", :ruby %>

Then run bundle install to finish installing Foundation.

NOTE: Make sure that your restart your server after running bundle install. Otherwise the asset pipeline may not recognize the new Foundation files.

Rails 4.0

Rails 4.0 removed the assets group from Gemfile. So make sure to move the zurb-foundation gem out of the assets group, when you're updating your rails app.

Easy Install

Simply run rails g foundation:install to configure your application to use Foundation. That's it!

Manual Installation

Add Foundation to your CSS

Append the following line to your app/assets/stylesheets/application.css file:

<%= code_example ' /*= require foundation */ ', :css %>

If you're planning on using Sass then you'll want to rename application.css to application.scss. That file should then look like:

<%= code_example ' @import "foundation"; ', :css %>
Add Foundation to your JS

Append the following lines to your app/assets/javascripts/application.js file:

<%= code_example ' //= require foundation $(document).foundation(); ', :js %>
Add Modernizr

Make sure that Modernizr is included in the <head> of your page:

<%= code_example ' javascript_include_tag "vendor/custom.modernizr" ', :ruby %>
Set Viewport Width

Add the following line to the <head> of your page layout:

<%= code_example ' ', :html %>
<%= render "_sidebar.html.erb" %>