我在Heroku上部署了一个新版本的Rails 5应用程序,运行在cedar-14堆栈上.它在部署时没有预编译,所以我heroku run rake assets:precompile手动完成.不过,我可以看到它包含旧资产,同时需要css和js文件.
我的文件都在,app/assets所以目录不可能不在资源编译路径中.
我的配置application.rb和production.rb:
config.assets.compile = true
# I checked the environment variable, it responds to 'enabled',
# which would return true for the option.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Which I changed to expire old assets.
config.assets.version='1.1'
Run Code Online (Sandbox Code Playgroud)
我尝试过这些,但它们不起作用:
$ heroku restart$ heroku run rake assets:precompile$ heroku run rake assets:clobber这些奇怪的是它们不会影响我检查过的heroku服务器中的资产$ heroku run ls public/assets.即便如此$ rake assets:precompile,即使这样说:
WRITING /app/public/assets/application-{VERY_LONG_HASH}.js
WRITING …Run Code Online (Sandbox Code Playgroud)