2013-04-30 31 views
0

assets/javascripts/創建new.js並加入到這個views/layouts/application.html.erb爲什麼jQuery在預編譯後停止工作,如果我在資產中混淆了js文件?

<%= javascript_include_tag 'new.js' %> 

然後我執行

bundle exec rake assets:precompile RAILS_ENV=production 

在此之後,jQuery的停止工作。
這可能是什麼原因,我將如何解決它?

UPDATE:

的application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// the compiled file. 
// 
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 
// GO AFTER THE REQUIRES BELOW. 
// 
//= require jquery 
//= require jquery-ui 
//= require twitter/bootstrap 
//= require jquery_ujs 
//= require jquery.ui.datepicker 
//= require autocomplete-rails 

回答

1

如果你想separetelly包括這個腳本,那麼你應該把它添加到您的環境配置。

config.assets.precompile += %w{ new.js } 
+0

感謝您的回覆。現在我回到以前的情況。因此,我刪除了'new.js'文件,並在'views/layouts/application.html.erb'中的行。然後,我再次捆綁exec rake資產:預編譯RAILS_ENV = production。但是,jQuery不會回來。這就是爲什麼我很困惑:( – cat 2013-04-30 02:41:25

+0

我不能刪除'預編譯相關文件'和重做嗎? – cat 2013-04-30 02:42:09

+0

我會粘貼所有。你需要看什麼類型的文件?只有application.js? – cat 2013-04-30 02:49:01

相關問題