0

我在其中创建new.js并将assets/javascripts/其添加到views/layouts/application.html.erb

<%= javascript_include_tag 'new.js' %>

然后我执行

bundle exec rake assets:precompile RAILS_ENV=production

在此之后,jQuery 停止工作。
这可能是什么原因,我将如何解决它?

更新:

应用程序.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
4

1 回答 1

1

如果您想单独包含此脚本,则应将其添加到您的环境配置中。

config.assets.precompile += %w{ new.js }
于 2013-04-30T02:39:28.607 回答