今天我對Ruby on Rails有一個令人不安的問題。 我的資產沒有編譯:我的意思是,即使使用資源:預編譯,它們也不會被編譯。Rails資產編譯不正確
我相信這會更好地說明問題。預編譯的資產之後,這是/public/assets/application.js的樣子:
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
;
也是一樣的CSS。 該項目在其他計算機上正常工作,所以我懷疑我的配置在這裏有問題。但是,可能會導致這種問題的原因是什麼?這不像Rails沒有嘗試預編譯,但是當他到達這些文件時,他只是將它們複製到資產文件夾中,而無需預編譯它們。
任何有關如何解決這個問題的線索?
編輯:資產的增加輸出:預編譯
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/plaristote/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /home/plaristote/.rvm/gems/[email protected]_commApp/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
/home/plaristote/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /home/plaristote/.rvm/gems/[email protected]_commApp/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
你試圖預編譯的地方?生產環境還是發展? – tbem 2013-04-04 15:12:44
開發和生產。請注意,在開發過程中,當我不預編譯資產時,應該通過Rails進行即時編譯:但是從我在瀏覽器中可以看到的收到的js和css文件根本不編譯(如上所示)。 – Michael 2013-04-04 15:54:30