bokmann / font-awesome-rails

the font-awesome font bundled as an asset for the rails asset pipeline
http://fortawesome.github.com/Font-Awesome/
MIT License
1.86k stars 244 forks source link

Rails 3.2 + Sprockets Backport Problems? #84

Closed rmm5t closed 10 years ago

rmm5t commented 10 years ago

Reported by @adelsmee in the thread of #11:

Hi, we are running rails 4 sprockets in a rails 3 application. See here: http://blog.logdown.com/posts/171593-using-rails-4-asset-pipeline-on-rails-3-for-faster-deploy

It's included in this css.sass file vendor.css.sass

//= require jquery/dialog.sass
//= require jquery/jquery.contextMenu.css
//= require leaflet/leaflet.css
//= require leaflet/zoomslider.css
//= require font-awesome
$bundle list | grep 'rails|sprockets'
coffee-rails (3.2.2)
coffee-rails-source-maps (1.4.0)
compass-rails (1.1.2 67779b4)
cucumber-rails (1.4.0)
font-awesome-rails (4.0.3.1)
jquery-rails (3.0.4)
lp_on_rails (0.2.0 d784ff5)
rails (3.2.16)
rspec-rails (2.99.0.beta1)
sass-rails (4.0.1 8e23667)
sprockets (2.2.2.backport2)
sprockets-rails (2.0.1 7f6d8d7)

We're getting the following in the browser:

couldn't find file 'font-awesome'
/Users/dev/.bundle/ruby/1.9.1/gems/sprockets-2.2.2.backport2/lib/sprockets/context.rb:106:in `resolve'

any suggestions on what we can do?

rmm5t commented 10 years ago

I can't vouch for running the Sprockets backport against Rails 3.2. We don't have any tests for this scenario, but I'm quickly trying adding a new gemfile to the build matrix to cover this. If I can't reproduce, I'm going to need that someone else come up with a gemfile for our build matrix that helps replicate the issue against our test suite.

rmm5t commented 10 years ago

@adelsmee Please see https://github.com/bokmann/font-awesome-rails/commit/a37a5f2cc0a2c95ee6806b7e9bc03827fd37d682

I was not able to reproduce your issue using the Sprockets backport. At least, our test suite passes while using Rails 3.2 and the Sprockets backport.

Any ideas?

Btw, I found that the backport managed by guilleiguaran/sass-rails is a much cleaner approach, especially because it doesn't rely on master branches in multiple forks.

gem "sprockets", "2.2.2.backport2"
gem "sprockets-rails", "2.0.0.backport1"
gem "sass-rails", :github => "guilleiguaran/sass-rails", :branch => "backport"

Lastly, I noticed that you opt for using Sprockets requires instead of sass imports. I've never been fond of using sprockets for what sass already does very well. What happens if you switch to the following in your vendor.css.sass file?

@import font-awesome
rmm5t commented 10 years ago

@adelsmee Any additional news on this issue? Were you able to workaround your problem, and/or can you help us reproduce the issue with a failing test case?

rmm5t commented 10 years ago

Closing due to lack of activity. /cc @adelsmee

SimonBirrell commented 10 years ago

+1 I'm seeing this. Rails 3.2, Ruby 2.1.2.

I get the error when precompiling assets:

rake aborted!
Sprockets::FileNotFound: couldn't find file 'font-awesome'
  (in /Users/simonbirrell/Documents/Dropbox/Git Projects/vemmleads/app/assets/stylesheets/application.css.scss:11)
SimonBirrell commented 10 years ago

Here's the Gemfile, if this helps:

source 'https://rubygems.org'
#ruby '1.9.3'
ruby '2.1.2'
gem 'rails', '3.2.18'

gem 'pg'

group :development do
  gem 'heroku_san'
  gem 'taps'
end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  gem "compass-rails", ">= 1.0.3" #, :group => :assets
  gem 'jquery-fileupload-rails'
  gem "zurb-foundation", '~> 4.2.3' #, :group => :assets
  gem 'font-awesome-sass', '~> 4.2.0'
  #gem "zurb-foundation", '~> 4.3.2' #, :group => :assets
end

gem 'execjs', '~> 1.4'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem "thin", ">= 1.5.0", :group => :production
gem "factory_girl_rails", ">= 4.1.0", :group => :test
gem "rspec-rails", :group => [:test, :development]
gem "database_cleaner", ">= 0.9.1", :group => :test
gem "email_spec", ">= 1.4.0", :group => :test

gem 'unicorn'
gem 'mongoid'
gem "devise", ">= 2.1.2"
gem "cancan", :git => "git://github.com/ryanb/cancan.git", :branch => "2.0"
gem "rolify", ">= 3.2.0"
gem "simple_form", ">= 2.0.4"
gem "quiet_assets", ">= 1.0.1", :group => :development
gem "better_errors", ">= 0.2.0", :group => :development
gem "binding_of_caller", ">= 0.6.8", :group => :development
gem 'will_paginate'
gem 'nokogiri'
gem 'mongo'
gem 'bson_ext'
gem 'fog'
gem 'carrierwave'
gem "newrelic_rpm"
gem "hirefire-resource"
gem "twilio-ruby"
gem "ancestry"
gem "pusher"
gem 'aws-sdk'   
gem 'activerecord-postgres-hstore'
gem 'treetop'
gem 'beeleads'
gem 'mysql2'
gem 'savon'

gem 'axlsx_rails'

gem "pagseguro-oficial", git: "git://github.com/pagseguro/ruby.git"

gem 'delayed_job_active_record'
gem 'dj_mon'

gem "koala"

gem 'rack-mini-profiler'
gem 'ruby-prof', group: :development

gem 'rabl'

group :development, :test do
  gem "capybara"
  gem 'rb-fsevent'
  #gem 'rb-readline', '~> 0.4.2'
  gem 'rb-readline'
  gem 'guard', '>=2.1.0'
  gem "guard-rspec"
  gem 'guard-zeus'
  gem "poltergeist"
end

group :test do
  gem 'timecop'
end
rmm5t commented 10 years ago

@SimonBirrell Try using our gem (font-awesome-rails) instead of font-awesome-sass :wink: