2013-04-30 42 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

相关问题