My background links and glyphicons stopped working on Heroku

Although all my background images and glyphicons are showing correctly on my localhost, they stopped working after my last boot to Heroku. All other images are displayed correctly.

My background images are defined by custom.css.scss as background-image: data-data-url ('bg-nav-dark.png'); I also tried Background Image: URL ('BG-nav.png');

My glyphicons in bootstrap.css are defined as:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: font-url('glyphicons-halflings-regular.eot');
  src: font-url('glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), etc.

      

When I check my home page on Heroku, the console sees these errors:

GET https://peaceful-harbor-2916.herokuapp.com/assets/bootstrap.css.map 404 (Not Found) peaceful-harbor-2916.herokuapp.com/:11 
GET https://peaceful-harbor- 2916.herokuapp.com/assets/bootstrap.css.map 404 (Not Found) application-a29ac562c89a1c46b8f0515885102bda.js:3509 
GET https://peaceful-harbor-2916.herokuapp.com/assets/bg-texture.png 404 (Not Found) application-a29ac562c89a1c46b8f0515885102bda.js:3509 
GET https://peaceful-harbor-2916.herokuapp.com/assets/bg-nav.png 404 (Not Found) application-a29ac562c89a1c46b8f0515885102bda.js:3509 
GET https://peaceful-harbor-2916.herokuapp.com/fonts/glyphicons-halflings-regular.woff application-a29ac562c89a1c46b8f0515885102bda.js:3509 

      

etc .. and others.

(The above lines give me an idea that precompiling puts assets in places where Rails can't find them afterwards) After pushing my code to Heroku, I precompile and get this response:

$ heroku run rake assets:precompile Running `rake
assets:precompile` attached to terminal... up, run.3123 rake aborted!
Sass::SyntaxError: Invalid CSS after "...":3,"sources":[": expected
"|", was ""bootstrap.css"..."   (in /app/app/assets/stylesheets/application.css)

      

I save my images and fonts in these folders:

/app
  /assets
    /fonts
    / images
    / stylesheets   

      

I don't know why, but precompilation results in images in path / public / assets

In application.rb I have the following lines:

config.assets.initialize_on_precompile = true  # I have tried false as well
config.i18n.enforce_available_locales = false
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
config.i18n.default_locale = :en
config.assets.paths << Rails.root.join("app", "assets")
config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.paths << Rails.root.join("app", "assets", "images")

      

My production.rb contains config.serve_static_assets = true

My application.css contains:

/*
 *= require jquery-ui/datepicker
 *= require_self
 *= require bootstrap
 *= require 'custom'
 *= require leaflet
 *= require_tree .
 */

      

Here is my Gemfile:

source 'https://rubygems.org'
source 'http://gemcutter.org'
source 'https://rails-assets.org'
gem 'rails', '4.1.7'
gem 'haml-rails'
gem 'bootstrap-sass', '~>3.2.0'
gem 'rails-assets-bootstrap'
gem 'rails-assets-leaflet'
gem 'sass', '~>3.2.0'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 2.3.0'
gem 'jquery-ui-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'pg'
group :development do
  gem 'spring'
  gem 'rails_12factor'
end
gem 'rake', '~> 10.3.2'
gem 'paper_trail', '~> 3.0.6'
group :test, :development do
  gem 'rspec-rails'
  gem 'sqlite3'
  gem 'simplecov'
end
group :test do
  gem 'capybara', '~> 2.4.0'
  gem 'database_cleaner', github: 'bmabey/database_cleaner'
  gem 'factory_girl_rails'
end
gem 'bcrypt', '~> 3.1.7'
ruby "2.1.4"

      

Please tell me what I am missing.

+3


source to share





All Articles