簡體   English   中英

Rails資產預編譯只是不工作

[英]Rails Assets Precompile just not working

我已經將Rails應用程序推送到Heroku並繼續遇到以下問題:

我將更改保存到我的主css.scss文件(在資產/樣式表中)或資產/圖像中的圖像,推送到git,將其推送到heroku,然后重新加載頁面,只是發現這些資產沒有已裝滿了。

這也是本地服務器上的一個小問題,但輸入:

rake assets:precompile

並重新加載本地服務器通常工作,而做

heroku run rake assets:precompile

然后重新推動什么也沒做。 我已經四處尋找信息並且沒有找到任何特別有幫助的東西。

值得注意的是,在我的config / application.rb中 (其中一些是釣魚的結果):

# Enable the asset pipeline
config.assets.enabled = true

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

config / environments / production.rb中

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false

# Compress JavaScripts and CSS
config.assets.compress = true

# Fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true

# Generate digests for assets URLs
config.assets.digest = true

還有其他可能的興趣,當我推送到heroku時,除其他外,它說:

Preparing app for Rails asset pipeline
       Detected manifest.yml, assuming assets were compiled locally
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets

Installing dependencies using Bundler version 1.3.0.pre.5
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment

我學習了Rails 3,並不知道資產管道與先前版本中的資源管道有何不同,所以很抱歉,如果我是一個白痴並在我的配置文件中放置重疊和/或相互矛盾的設置。

非常感謝任何幫助。 這一直很頭疼。

看起來你可能會將你的本地編譯資產添加到git並推送它們,因此Heroku不會在推送時編譯你的資產。 檢查以確保您沒有將公共/資產目錄添加到git。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM