Fixing CSS Issues on Heroku
Learn how to implement CSS fixes to have Heroku match the design for the local system.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

In this video, we are going to fix some of the issues we have on heroku, especially on the admin homepage.

I think the best way is add some code to our production file. Open production.rb , and update the serve_static_assets and assets.compile options so the file looks like this:

# config/environments/production.rb

Rails.application.configure do
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
  config.assets.js_compressor = :uglifier
  config.assets.compile = true
  config.assets.digest = true
  config.log_level = :debug
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
  config.log_formatter = ::Logger::Formatter.new
  config.active_record.dump_schema_after_migration = false
  config.serve_static_assets = true
  config.action_mailer.default_url_options = { :host => 'wlp-overtime.herokuapp.com' }
end

Upload the file to github and then, to heroku. Restart heroku, and open the browser. You'll see that the styles are now showing up properly.

large