files produced by asset:precompile don't match urls generated by stylesheet_link_tag (missing digest) in minimal rails 4 site -
i'm using ruby 2.0.0-p247
, rails 4.0.0
if make minimal rails 4 site this:
rails new minimal cd minimal rails generate controller home index tee config/routes.rb <<eof minimal::application.routes.draw root 'home#index' end eof
then precompile assets with
rake assets:precompile
it generates assets like:
i, [2013-09-04t17:05:36.992951 #3549] info -- : writing /workingdir/minimal/public/assets/application-723d1be6cc741a3aabb1cec24276d681.js i, [2013-09-04t17:05:37.052303 #3549] info -- : writing /workingdir/minimal/public/assets/application-f1a14051f17824976271b9c0460232f0.css
but if start server in production mode, with
rails_env=production rails s
the generated urls in html don't point @ precompiled files:
<link data-turbolinks-track="true" href="/stylesheets/application.css" media="all" rel="stylesheet" /> <script data-turbolinks-track="true" src="/javascripts/application.js"></script>
i expect, rather:
<link data-turbolinks-track="true" href="assets/application-f1a14051f17824976271b9c0460232f0.css" media="all" rel="stylesheet" /> <script data-turbolinks-track="true" src="/assets/application-723d1be6cc741a3aabb1cec24276d681.js"></script>
the default config/environments/production.rb
settings use digests:
config.assets.digest = true
but seems selectively ignored?
am missing something?
update:
i tested in rails 4.2.3 , appears fixed, need hand few more environment variables rails s
command start in production mode:
secret_key_base=$(rake secret) rails_serve_static_files=true rails_env=production rails s
while writing question came across blog post suggests bug.
http://railsblog.kieser.net/2013/08/rails4-phusion-passenger-asset-pipeline.html
of various suggestions, setting compilation fallback true...
config.assets.compile = true
seems sufficient kick rails in generating appropriately digested urls:
<link data-turbolinks-track="true" href="/assets/application-f1a14051f17824976271b9c0460232f0.css" media="all" rel="stylesheet" /> <script data-turbolinks-track="true" src="/assets/application-723d1be6cc741a3aabb1cec24276d681.js"></script>
the other suggestion, explicitly setting rails_env , rails_groups seemed produce different digest strings on precompiled files, seem match generated html regardless.
Comments
Post a Comment