gem jquery-ui-rails无法找到文件'jquery.ui.all'( [英] gem jquery-ui-rails couldn't find file 'jquery.ui.all' (
问题描述
我试图在 jquery-ui-rails gem 的帮助下将jquery ui datepicker添加到我的应用程序中。我已经检查过 Railscast 我似乎一切正常,但是在应用程序启动时出现错误
找不到文件'jquery.ui.all'
I'm trying to add jquery ui datepicker to my application with help of jquery-ui-rails gem. I've checked Railscast I seem to do everything right, but i get an error upon application startup
couldn't find file 'jquery.ui.all'
Gemfile(结尾,尝试过在资产组中包括宝石,但没有运气):
Gemfile(end of it, tried to include gem in the assets group but no luck):
gem 'backbone-on-rails'
gem "jquery-ui-rails"
application.js
application.js
//= require jquery
//= require jquery_ujs
//= require underscore
//= require backbone
//= require svitla_test
//= require_tree ../templates
//= require_tree ./models
//= require_tree ./collections
//= require_tree ./views
//= require_tree ./routers
//= require_tree .
//= require jquery.ui.all
application.css
application.css
*= require jquery.ui.all
*= require_self
*= require_tree .
推荐答案
放置 // = require jquery.ui.all
紧接在 // =之后,需要jquery
,所以它看起来像这样
Put //= require jquery.ui.all
right after //= require jquery
so it will look like this
//= require jquery
//= require jquery.ui.all
//= require jquery_ujs
//= require underscore
//= require backbone
//= require svitla_test
//= require_tree ../templates
//= require_tree ./models
//= require_tree ./collections
//= require_tree ./views
//= require_tree ./routers
//= require_tree .
请注意,这些行写入的顺序是这些文件加载的顺序。如果您在知道 jquery-ui
是什么之前调用 jquery-ui
函数,则很可能需要更改请稍等..
note that the order of which these lines are written is the order which these files are loaded.. So if you call a jquery-ui
function before it knows what jquery-ui
is, most likely you need to change the order a bit..
通常情况下,将基础设施文件放在自己的文件之前是为了避免这些问题。
It is usually good to put infrastructure files before your own files to avoid these kind of problems
这篇关于gem jquery-ui-rails无法找到文件'jquery.ui.all'(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!