3

I am using Rails 4.2.0 and all of a sudden my style tag in my application.html.erb layout doesn't render the application.css anymore.

In my layout I have:

<%= stylesheet_link_tag 'application', media: 'all' %>

Which produces this error:

Showing /****/app/views/layouts/application.html.erb where line #5 raised:

TypeError: undefined is not an object (evaluating 'processor.process')
  (in /****/app/assets/stylesheets/application.scss)

Which line 5 is simply the stylesheet_link_tag above.

If it helps my Gem file looks like this:

gem 'rails', '~> 4.2.0'
gem 'mysql2'
gem 'sass-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'bootstrap-sass'
gem 'bootstrap_form'
gem 'autoprefixer-rails'
gem 'bcrypt-ruby', :require => 'bcrypt' 
gem 'lodash-rails'
gem 'angular-rails-templates'
gem 'mini_magick'
gem 'refile', require: ['refile/rails', 'refile/image_processing']
gem 'aws-sdk'
gem 'RedCloth'
gem 'sass-json-vars'

Removing the stylesheet_link_tag makes the application run fine. Keeping the tag but emptying the application.scss file does not.

Any ideas?

Ian Briggs
  • 35
  • 6
  • Try adding `gem 'therubyracer', platforms: :ruby` to your Gemfile....and of course bundle install and restart your server. – Justin Jan 16 '15 at 04:07
  • That fixed the error. The font files are missing from Bootstrap SASS but I can work with that now. At lease I can debug it. Would you mind explaining why Googles V8 engine would fix this? – Ian Briggs Jan 16 '15 at 04:17
  • Add `@import 'bootstrap-sprockets';` before importing `bootstrap` or custom variables in your application.scss to fix the font issue. – Justin Jan 16 '15 at 04:18
  • Ok thanks for that! Did you want to put your comments in as an answer so I can vote you up? – Ian Briggs Jan 16 '15 at 04:20
  • hope everything is working for ya now. – Justin Jan 16 '15 at 04:24

1 Answers1

2

To fix the process error, add therubyracer to your Gemfile. Credit to this S.O. question.

gem 'therubyracer', platforms: :ruby

and to fix the Bootstrap glyphicons issue, import bootstrap-sprockets prior to importing Bootstrap or custom variables in your application.scss

@import 'bootstrap-sprockets';

For reference to missing icons, here is a nice snippet from the Bootstrap-sass README.

Community
  • 1
  • 1
Justin
  • 4,922
  • 2
  • 27
  • 69