Sas*_*sha 11 ruby-on-rails heroku ruby-on-rails-3 asset-pipeline
我已经将Rails应用程序推送到Heroku并继续遇到以下问题:
我将更改保存到我的主css.scss文件(在资产/样式表中)或资产/图像中的图像,推送到git,将其推送到heroku,然后重新加载页面,只是发现这些资产没有已装满了.
这也是本地服务器上的一个小问题,但输入:
rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
并重新加载本地服务器通常工作,而做
heroku run rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
然后重新推动什么也没做.我已经四处寻找信息并且没有找到任何特别有帮助的东西.
值得注意的是,在我的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
Run Code Online (Sandbox Code Playgroud)
在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
Run Code Online (Sandbox Code Playgroud)
还有其他可能的兴趣,当我推送到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
Run Code Online (Sandbox Code Playgroud)
和
Installing dependencies using Bundler version 1.3.0.pre.5
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Run Code Online (Sandbox Code Playgroud)
我学习了Rails 3并且不知道资产管道与先前版本中的资源管道有何不同,所以很抱歉,如果我是一个白痴并在我的配置文件中放置重叠和/或矛盾的设置.
非常感谢任何帮助.这一直很头疼.
Kar*_*aum 13
看起来你可能会将你的本地编译资产添加到git并推送它们,因此Heroku不会在推送时编译你的资产.检查以确保您没有将公共/资产目录添加到git.
归档时间: |
|
查看次数: |
15645 次 |
最近记录: |