3
votes

I have rails 4 application + ruby 2.0 in development environment all works fine but whan i try to deploy my project througt capistrano i have problem with assets the application do not see assets fonts, css js e.t.c.

This is mine production.rb file:

  config.assets.paths << Rails.root.join('app', 'assets', 'font')
  config.assets.precompile << ['*.js', '*.css','*.jpg','*,woff','*.ttf']

The comand RAILS_ENV=production bundle exec rake assets:precompile create precompile file with md5 hash fontawesome-webfont-62877-e70f92449ebfddada3d455eb44542655.woff but appication have error 404. enter image description here

enter image description here The same story with images and css only to_net_me-581dde7532a5978e49036426aa617523.js and to_net_me-515aa8a1f84b86e9084a3e925e512023.css have 200 status code.

This is my layout/application.html.slim:

doctype 5
html
  head
    title 2net.me
    /![if lt IE 9]
      | <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
    = stylesheet_link_tag    "to_net_me", :media => "all"
    = javascript_include_tag "to_net_me"
    = csrf_meta_tags
  body
    / = render partial: 'layouts/flash', locals: { flash: flash } unless flash.empty?
    = render 'layouts/header'
    /main content render here
    .container-fluid-full
      -if current_user
        .row-fluid
          = render "shared/menu/main_menu"
          = yield
      -else
        = yield
    = render 'layouts/footer'

the problem not in how to create fonts the problem in when you precompile assets for production font creates but with md5 fingerprint. But after in Network console have fontawesome-webfont-62877.woff 404 error. It looks like rails do not see precompile assets in public/assets fontawesome-webfont-62877-e70f92449ebfddada3d455eb44542655.woff but when i am add file fontawesome-webfont-62877.woff without md5 it is work fine. How to create precompile that rails see fonts in production.

1
in your screenshots you have all those 404 calls on localhost how is that going to work in production? - phoet
This is production mod in localhost. - Sergey Chechaev
@SergeyChechaev same problem here. How do you fixed it? Thanks - Luccas
Use gem "non-stupid-digest-assets" - Sergey Chechaev

1 Answers

0
votes

There is a gem called "non-stupid-digest-assets" which will create files both with and without md5 hash. You can use that.