[英]JavaScript caching, Rails and Apache passenger?
I have written a Capistrano recipe to remove the all.js
cached JavaScript file and tell the server to restart, but it still doesn't work right. 我写了一个Capistrano配方来删除
all.js
缓存的JavaScript文件并告诉服务器重新启动,但它仍然无法正常工作。 And inevitably I have to go manually delete the all.js
file and then manually restart Apache. 并且我不得不手动删除
all.js
文件,然后手动重启Apache。 (touching restart.txt doesn't always work). (触摸restart.txt并不总是有效)。
Anybody have a working solution to this problem? 有人有解决这个问题的工作方法吗?
Here is the current recipe: 这是当前的食谱:
desc "Package Javascripts"
task :package_javascripts, :roles => :web do
sudo %{rm -f #{current_path}/public/javascripts/all.js}
javascripts.each do |javascript|
run %{/usr/bin/ruby #{current_path}/lib/jsmin.rb < \
#{current_path}/public/javascripts/#{javascript}.js >> \
#{current_path}/public/javascripts/all.js}
end
run "touch #{current_path}/tmp/restart.txt"
end
Did you linked you task somewhere: 你有没有把你的任务链接到某处:
after "deploy:symlink", :package_javascripts
Also change restart line to: 同时将重启行更改为:
run "rm -f #{current_path}/tmp/restart.txt ; touch #{current_path}/tmp/restart.txt"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.