Sean Szurko
Sean Szurko

Reputation: 253

rails_admin File to import not found or unreadable: font-awesome

As the title says when I try to access the admin panel at localhost:3000/admin I am confronted with a Sass:StyntaxError in RailsAdmin::MainController#dashboard File to import not found or unreadable: font-awesome. I am using font-awesome in my application in other areas. I have tried most other solutions without any progress. My gem file is as follows:

source 'https://rubygems.org'

gem 'rails',                        '4.2.3'
gem 'bootstrap-sass',               '3.2.0.0'

gem 'sprockets-rails', :require =>  'sprockets/railtie'
gem 'uglifier',                     '2.5.3'
gem 'coffee-rails',                 '4.1.0'
gem 'jquery-rails',                 '4.0.3'
gem 'turbolinks',                   '2.3.0'
gem 'jbuilder',                     '2.2.3'
gem 'sdoc',                         '0.4.0', group: :doc
gem 'jquery-turbolinks',            '2.1.0'
gem "font-awesome-rails",           '4.4.0.0'
gem "devise",                       '3.5.2'
gem 'bootstrap-datepicker-rails',   '1.4.0'
gem 'jquery-timepicker-rails',      '1.4.3'
gem 'will_paginate',                '3.0.7'
gem 'bootstrap-will_paginate'
gem 'rails_admin',                  '0.7.0'

group :development, :test do
  gem 'sqlite3',                    '1.3.9'
  gem 'byebug',                     '3.4.0'
  gem 'web-console',                '2.0.0.beta3'
  gem 'spring',                     '1.1.3'
end

group :test do
  gem 'minitest-reporters',         '1.0.5'
  gem 'mini_backtrace',             '0.1.3'
  gem 'guard-minitest',             '2.3.1'
end

group :production do
  gem 'pg',                         '0.17.1'
  gem 'rails_12factor'
  gem 'sass-rails'
end

and a trace leads to this file rails_admin (0.7.0) app/assets/stylesheets/rails_admin/rails_admin.scss.erb:60

which is this

Extracted source (around line #60):

58 @import "rails_admin/ra.widgets";
59 @import "rails_admin/jquery.colorpicker";
60
61 /*** Font-awesome ***/
62
63 @import 'font-awesome';

Upvotes: 1

Views: 2976

Answers (2)

hww
hww

Reputation: 11

  • add this to Gemfile.lock gem "font-awesome-rails"
  • bundle install
  • add @import "font-awesome"; to application.css.scss file
  • restart app
  • helper method fa_icon ,ect fa_icon "camera-retro"

Upvotes: 1

Sean Szurko
Sean Szurko

Reputation: 253

Solved, added gem 'font-awesome-sass', '~> 4.4.0' along with

@import "font-awesome-sprockets";
@import "font-awesome"; 

to the application.css.scss file and then

Rails.application.config.assets.precompile += %w( fontawesome-webfont.ttf )
Rails.application.config.assets.precompile += %w( fontawesome-webfont.svg )

to the config.assets.rb file

Upvotes: 1

Related Questions