2016-03-07 116 views
0

我的资产没有任何更新。我使用与我一样的设置,但是现在,当我对我的任何'.html.erb'文件或'.scss'文件进行更改时,它们在我将它们添加到git并部署时没有显示出来他们与capistrano。任何想法可能会发生什么?未部署Rails Ubuntu/passenger/capistrano应用程序资产

也许我应该重新安装我正在部署到的远程服务器上的所有内容?

我使用:
Rails的4.2.5.1
红宝石2.2.3p173

production.rb:

Rails.application.configure do 
    # Settings specified here will take precedence over those in config/application.rb. 

    # Code is not reloaded between requests. 
    config.cache_classes = true 

    # Eager load code on boot. This eager loads most of Rails and 
    # your application in memory, allowing both threaded web servers 
    # and those relying on copy on write to perform better. 
    # Rake tasks automatically ignore this option for performance. 
    config.eager_load = true 

    # Full error reports are disabled and caching is turned on. 
    config.consider_all_requests_local  = false 
    config.action_controller.perform_caching = false 

    # Enable Rack::Cache to put a simple HTTP cache in front of your application 
    # Add `rack-cache` to your Gemfile before enabling this. 
    # For large-scale production use, consider using a caching reverse proxy like 
    # NGINX, varnish or squid. 
    # config.action_dispatch.rack_cache = true 

    # Disable serving static files from the `/public` folder by default since 
    # Apache or NGINX already handles this. 
    config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 
    #config.serve_static_files = false 

    # Compress JavaScripts and CSS. 
    config.assets.js_compressor = :uglifier 
    #config.assets.css_compressor = :sass 

    # Do not fallback to assets pipeline if a precompiled asset is missed. 
    config.assets.compile = false 
    config.assets.initialize_on_precompile = false 

    # Asset digests allow you to set far-future HTTP expiration dates on all assets, 
    # yet still be able to expire them through the digest params. 
    config.assets.digest = true 
end 

我也用RAILS_ENV=production rake asssets:precompile部署之前编译我的资产。

+0

尝试将config.assets.compile更改为true并 config.assets.precompile = ['* .js','* .scss','* .css'] – toddmetheny

+0

需要在.js和.js前加星号。 CSS,但堆栈由于某种原因没有阅读这些内容。 – toddmetheny

回答

0

你可以尝试在本地预编译你的资产,提交然后再部署。

rake assets:precompile 

这不是最好的做法,但是我以前在需要时做过。还要在部署过程中检查堆栈跟踪。通常,在您的css或js的某个地方出现错误,导致资产无法编译。

+0

我试过rake资产:没有rails_env = production的预编译。但遇到同样的问题。我将检查我的跟踪,看看在编译期间是否从资产中获得任何错误。谢谢。 @toddmetheny – Corey

+0

当我在本地运行时,我不断收到: 'App 12242 stderr:autoprefixer:/Users/coreyvincent/Desktop/Applications/RailsApp/app/assets/stylesheets/application.scss:38487:3:渐变过时了方向语法。新的语法就像'左'而不是'右'。' 不管是什么意思......? @toddmetheny – Corey

+0

是的 - 这意味着你的scss有一个错误,使你的资产不能编译。您需要查找并调试该错误。 – toddmetheny