1

I am trying to integrate the present theme in my rails app. After intgerating when I run

rake assets:precompile --trace

I get the following error.

** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
Sass::SyntaxError: Undefined variable: "$fa-css-prefix".
/home/munam/projects/infotachus/ror/nutritious_dec_28/app/assets/stylesheets/_animated.scss:4
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/variable.rb:49:in `_perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/node.rb:50:in `perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/interpolation.rb:170:in `_perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/node.rb:50:in `perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:540:in `block in run_interp_no_strip'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:538:in `map'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:538:in `run_interp_no_strip'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:545:in `run_interp'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:410:in `visit_rule'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:79:in `block in with_base'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:115:in `with_frame'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:79:in `with_base'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:158:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `map'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:157:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:8:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/root_node.rb:36:in `css_tree'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/root_node.rb:20:in `render'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/engine.rb:278:in `render'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:74:in `block in call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/utils.rb:154:in `module_include'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:73:in `call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:30:in `call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/bundle.rb:23:in `block in call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/utils.rb:183:in `dfs'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/bundle.rb:24:in `call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/base.rb:66:in `find_asset'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:142:in `block in find'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:225:in `block in stat_tree'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:209:in `block in stat_directory'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:206:in `each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:206:in `stat_directory'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:224:in `stat_tree'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:105:in `each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:104:in `each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:140:in `find'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:168:in `compile'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/home/munam/.rvm/rubies/ruby-2.2.3/bin/rake:33:in `<main>'

I have three folders in my theme

  1. less
  2. css
  3. scss

When integrating into my app I have merged files of these folders in one folder.

app/assets/stylesheets

Here are the gems in my gemfile.

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :assets do
  gem 'sass-rails', '~> 5.0'
  gem 'font-awesome-rails'
  gem 'font-awesome-sass'
  gem 'font-awesome-sass-rails'
  gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'

end

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
  gem 'dotenv-rails'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
  gem 'better_errors'
  gem 'binding_of_caller'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

gem 'devise'
gem 'amazon-ecs'
gem 'sucker'
gem 'vacuum'
gem 'actionpack-xml_parser'

I have only these two lines in my application.css

 *
 *= require_tree .
 *= require_self
 */

and this line in my config/initializers/assets.rb

Rails.application.config.assets.precompile += [/.*\.png/,/.*\.ico/,/.*\.jpg/,/.*\.js/,/.*\.scss/]

I have tried all the threads on stackoverflow and github but nothing seems to work in my case. What to look for is still not clear. Any help would be really great. Lots of thanks in advance!

2 Answers 2

2

You only need one reference to font-awesome once in your Gemfile:

gem 'font-awesome-rails', '~> 4.5'

--

As for the error, it means you're trying to call a variable before it's been declared.

Because this is a font-awesome error, I'd speculate that it's because you've included 3 different gems in your Gemfile.

Get rid of all the gems except the one I've included above.

You also need to include the relevant font-awesome files in your CSS pipeline:

#app/assets/stylesheets/application.css
 *
   *= require font-awesome
   *= require_tree .
   *= require_self
 */
Sign up to request clarification or add additional context in comments.

7 Comments

Issue remains even after doing this. there are two font-awesome one with the .css and other with .scss
Where are you finding these .css files? They shouldn't be in your app; they're added by font-awesome itself
these are in my app/assets/stylesheets ..actually three files 1.css 2.scss 3.less
Delete them and try it again
deleted all three, ran bundle and then precompile and getting this error -- Sprockets::FileNotFound: couldn't find file 'font-awesome' with type 'text/css'
|
0

Just add these lines in your config/application.rb if you are using scss instead of css.

config.assets.precompile << %w( *.scss *.js )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.