ruby on rails - some of my images, my javascript and my bootstrap css won't work on heroku -
i have found bunch of solutions , tried implement them, none of them solved issue. java script code in : assets/javascripts/application.js css bootstrap in : assets/stylesheets/custom.css.scss , images in: assets/images of them png.
i've included rails_12factor gem in gem file
source 'https://rubygems.org' # bundle edge rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.0' # use sqlite3 database active record # use scss stylesheets gem 'sass-rails', '~> 4.0.0' # use uglifier compressor javascript assets gem 'uglifier', '>= 1.3.0' # use coffeescript .js.coffee assets , views gem 'coffee-rails', '~> 4.0.0' # see https://github.com/sstephenson/execjs#readme more supported runtimes # gem 'therubyracer', platforms: :ruby # use jquery javascript library gem 'jquery-rails' # turbolinks makes following links in web application faster. read more: https://github.com/rails/turbolinks gem 'turbolinks' # build json apis ease. read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 1.2' # gem encryption gem 'bcrypt-ruby', '3.0.1' # gem bootstrap gem 'bootstrap-sass', '2.3.2' group :doc # bundle exec rake doc:rails generates api under doc/api. gem 'sdoc', require: false end group :development, :test gem 'sqlite3' end group :production gem 'pg' gem 'rails_12factor' end
i've updated environments/production.rb file
project::application.configure # settings specified here take precedence on in config/application.rb. # code not reloaded between requests. config.cache_classes = true # eager load code on boot. eager loads of rails , # application in memory, allowing both thread web servers # , relying on copy on write perform better. # rake tasks automatically ignore option performance. config.eager_load = true # full error reports disabled , caching turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # enable rack::cache put simple http cache in front of application # add `rack-cache` gemfile before enabling this. # large-scale production use, consider using caching reverse proxy nginx, varnish or squid. # config.action_dispatch.rack_cache = true # disable rails's static asset server (apache or nginx this). config.serve_static_assets = true # compress javascripts , css. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # not fallback assets pipeline if precompiled asset missed. config.assets.compile = false # generate digests assets urls. config.assets.digest = true # version of assets, change if want expire assets. config.assets.version = '1.0' # specifies header server uses sending files. # config.action_dispatch.x_sendfile_header = "x-sendfile" # apache # config.action_dispatch.x_sendfile_header = 'x-accel-redirect' # nginx # force access app on ssl, use strict-transport-security, , use secure cookies. # config.force_ssl = true # set :debug see in log. config.log_level = :info # prepend log lines following tags. # config.log_tags = [ :subdomain, :uuid ] # use different logger distributed setups. # config.logger = activesupport::taggedlogging.new(sysloglogger.new) # use different cache store in production. # config.cache_store = :mem_cache_store # enable serving of images, stylesheets, , javascripts asset server. # config.action_controller.asset_host = "http://assets.example.com" # precompile additional assets. # application.js, application.css, , non-js/css in app/assets folder added. # config.assets.precompile += %w( search.js ) # ignore bad email addresses , not raise email delivery errors. # set true , configure email server immediate delivery raise delivery errors. # config.action_mailer.raise_delivery_errors = false # enable locale fallbacks i18n (makes lookups locale fall # i18n.default_locale when translation can not found). config.i18n.fallbacks = true # send deprecation notices registered listeners. config.active_support.deprecation = :notify # disable automatic flushing of log improve performance. # config.autoflush_log = false # use default logging formatter pid , timestamp not suppressed. config.log_formatter = ::logger::formatter.new end
i tried add
config.assets.initialize_on_precompile = false
to application.rb
per request adding application.js
$(document).on('page:load', function() { $( ".draggable" ).draggable(); }); $(document).ready(function(){ $(".draggable").draggable(); });
am missing anything?
images issue solved replacing html code <img src= ""> <%= image_tag("") %>
bootstrap icons- had download them directly http://glyphicons.com/, , change html <%= content_tag(:i, "", class: "icon-user") %>
javascript issue resolved afterward
Comments
Post a Comment