I have tried multiple ways to get some images to show up that are embedded in my style.css.erb file upon a Heroku deploy. I have no problems with the images showing up locally just upon deploy so I am assuming this is due to the precompiled assets. Here is what I have, any help/advice is much appreciated:
style.css.erb
#parallax1{
background-image:url('<%= asset_path("parallax/1.jpg")%>');
}
#parallax2{
background-image:url('<%= asset_path("parallax/2.jpg")%>');
}
#intro{
position: relative;
margin: 0 auto;
width: 100%;
overflow-x: hidden;
height:650px;
z-index:2;
background-image: url('<%= asset_path("bgslides/3.jpg")%>');
background-size:cover;
}
production.rb
config.assets.precompile += %w( jquery.js bootstrap.min.js jquery.nav.js jquery.scrollTo.js grid.js custom.js stellar.js modernizr.custom.js jquery.simple-text-rotator.min.js wow.min.js mb.bgndGallery.effects.js mb.bgndGallery.js font-awesome.css.scss.erb animate.css bootstrap.min.css simpletextrotator.css style.css.erb *.jpg *.png )
assets.rb
config.assets.precompile += %w( jquery.js bootstrap.min.js jquery.nav.js jquery.scrollTo.js grid.js custom.js stellar.js modernizr.custom.js jquery.simple-text-rotator.min.js wow.min.js mb.bgndGallery.effects.js mb.bgndGallery.js font-awesome.css.scss.erb animate.css bootstrap.min.css simpletextrotator.css style.css.erb *.jpg *.png )
application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module DryerPlug
class Application < Rails::Application
config.assets.paths << Rails.root.join("app", "assets", "fonts")
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/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:
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
gem 'spring', group: :development
gem 'mail_form'
gem 'simple_form'
gem 'pg', group: :production
gem 'rails_12factor', group: :production
heroku run rake assets:precompile? Always worth a try.bundle updatebecause there was something related changed in sprockets semi-recently.