我配置我的應用程序在Heroku上的內容更新,但我有一個問題。在開發模式下,當我更改CSS的一部分並刷新瀏覽器時,我的CSS不會加載。我的application.js將無法正常工作和application.css不會在Rails的
我查了日誌和application.css不會加載。我需要它在開發模式下每次加載。此外,我的application.js停止工作,我不知道爲什麼。
development.rb:
# Do not compress assets
config.assets.compress = false
config.assets.precompile += %w(login.css)
# Expands the lines which load the assets
config.assets.debug = true
enviroment.rb:
config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.assets.initialize_on_precompile = true
我編譯資產使用$ rake assets:precompile RAILS_ENV=development
手動和它的作品除外的application.js代碼:
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require jquery.reveal
$(document).ajaxStart(function() {
$("#load_img").animate({
height:"toggle",
opacity:"toggle"
});
});
$(document).ajaxSuccess(function() {
$("#load_img").fadeOut('fast');
});
$(document).ready(function() {
setTimeout(
function() {
$("#flash_messages").fadeOut(3000)
},
2500);
});
在部署到Heroku之前一切正常。
由於通過本名爲.js解決,非常感謝的解決方案,但是在CSS我改變的地方,你怎麼說,但這個沒有解決我的問題,我需要編譯成作品的CSS,我想改變的CSS代碼,刷新瀏覽器工作我的變化,即時開發需要這個,以及在我之前爲heroku不知道什麼 – overallduka 2013-02-15 23:53:40
正如@ Qumara指出,你應該運行'$ rake assets:clean'來刪除你的編譯版本。那麼你應該能夠看到變化。 – AJcodez 2013-02-15 23:57:21