I noticed that locally we were getting errors about 7 different jquery-ui images, e.g. ActionController::RoutingError (No route matches [GET] "/public/ui-bg_highlight-soft_100_eeeeee_1x100.png")
我注意到,在本地,我们得到了大约7个不同的jquery-ui映像,例如:RoutingError(没有路径匹配[GET] "/public/ui-bg_highlight- soft_100_eeeeeeeee_1x100.png ")
These assets do actually exist within the jquery-ui file structure.
这些资产实际上存在于jquery-ui文件结构中。
I have found that changing the url's used within the jquery-ui framework css itself from "url(/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
" to "url(/assets/ui-bg_highlight-soft_100_eeeeee_1x100.png
" or "url(ui-bg_highlight-soft_100_eeeeee_1x100.png
" removes the error (though I had to also do a rake assets:precompile
locally). However this seems like a bad approach and not the right thing to do.
我发现将jquery-ui框架css中使用的url从“url(/images/ui-bg_highlight- soft_100_eeeeeeeeee_1x100)”更改。png”到“url(/资产/ ui-bg_highlight-soft_100_eeeeee_1x100。(ui-bg_highlight-soft_100_eeeeee_1x100 png”或“url。png“删除错误(尽管我还必须做一个rake资产:本地预编译)”。然而,这似乎是一种糟糕的做法,而不是正确的做法。
What is the right approach to resolving these errors?
解决这些错误的正确方法是什么?
3 个解决方案
#1
2
First off, I highly recommend using the jquery-ui-rails gem to easily roll jquery ui into the assets pipeline.
首先,我强烈建议使用jquery-ui-rails gem将jquery ui轻松地滚到资产管道中。
In your Gemfile:
在你Gemfile:
group :assets do
gem 'jquery-ui-rails' # jquery ui
end
In your app/assets/stylesheets/application.css:
在app /资产/样式表/ application.css:
*= require jquery.ui.all
Note that you can only require the parts of jquery ui you use, like the progressbar or datepicker, ala jquery.ui.progressbar
注意,您只能要求使用jquery ui的部分,比如progressbar或datepicker, ala .ui.progressbar
And in app/assets/javascripts/application.js:
在app /资产/ javascript / application.js:
//= require jquery.ui.all
Now run bundle install
and voila! You're set!
现在运行bundle安装!你设置!
#2
1
The final result was:
最后的结果是:
- delete my local versions.
- 删除我的本地版本。
- add the items to the jquery js and css manifest files.
- 将项目添加到jquery js和css清单文件中。
- use the jquery-ui-rails gems
- 使用jquery-ui-rails宝石
#3
0
Observe what path is 404 Not Found in your browser, and then make sure the query-ui theme's /images directory is either moved or linked to that path in the Rails app.
观察浏览器中没有找到404路径,然后确保查询-ui主题的/images目录被移动或链接到Rails应用程序中的路径。
Example
例子
I experience 404 for:
我404经验:
http://localhost:3000/assets/images/ui-icons_ffffff_256x240.png
My jquery-ui theme directory is in /vendor, so the real path to the images is:
我的jquery-ui主题目录在/vendor中,所以图像的真正路径是:
RAILS_ROOT/vendor/assets/stylesheets/ui-lightness/images
So, to fix the 404, put a symbolic link to that directory where it's expected:
因此,要修复404,请将一个符号链接放在预期的目录中:
% cd vendor/assets/stylesheets
% ln -s ui-lightness/images images
Now, that URL serves the images.
这个URL提供图像。
#1
2
First off, I highly recommend using the jquery-ui-rails gem to easily roll jquery ui into the assets pipeline.
首先,我强烈建议使用jquery-ui-rails gem将jquery ui轻松地滚到资产管道中。
In your Gemfile:
在你Gemfile:
group :assets do
gem 'jquery-ui-rails' # jquery ui
end
In your app/assets/stylesheets/application.css:
在app /资产/样式表/ application.css:
*= require jquery.ui.all
Note that you can only require the parts of jquery ui you use, like the progressbar or datepicker, ala jquery.ui.progressbar
注意,您只能要求使用jquery ui的部分,比如progressbar或datepicker, ala .ui.progressbar
And in app/assets/javascripts/application.js:
在app /资产/ javascript / application.js:
//= require jquery.ui.all
Now run bundle install
and voila! You're set!
现在运行bundle安装!你设置!
#2
1
The final result was:
最后的结果是:
- delete my local versions.
- 删除我的本地版本。
- add the items to the jquery js and css manifest files.
- 将项目添加到jquery js和css清单文件中。
- use the jquery-ui-rails gems
- 使用jquery-ui-rails宝石
#3
0
Observe what path is 404 Not Found in your browser, and then make sure the query-ui theme's /images directory is either moved or linked to that path in the Rails app.
观察浏览器中没有找到404路径,然后确保查询-ui主题的/images目录被移动或链接到Rails应用程序中的路径。
Example
例子
I experience 404 for:
我404经验:
http://localhost:3000/assets/images/ui-icons_ffffff_256x240.png
My jquery-ui theme directory is in /vendor, so the real path to the images is:
我的jquery-ui主题目录在/vendor中,所以图像的真正路径是:
RAILS_ROOT/vendor/assets/stylesheets/ui-lightness/images
So, to fix the 404, put a symbolic link to that directory where it's expected:
因此,要修复404,请将一个符号链接放在预期的目录中:
% cd vendor/assets/stylesheets
% ln -s ui-lightness/images images
Now, that URL serves the images.
这个URL提供图像。