在生产中使用jquery-ui-rails gem时,Heroku找不到jquery.ui

时间:2022-12-14 20:38:56

I'm using the jquery-ui-rails gem. It works fine on local host, but when I push to heroku it gives heroku logs shows this:

我正在使用jquery-ui-rails gem。它在本地主机上工作正常,但当我推送到heroku时,它给heroku日志显示:

2012-04-11T02:28:59+00:00 app[web.1]: ActionView::Template::Error (couldn't find file 'jquery.ui.slider'
2012-04-11T02:28:59+00:00 app[web.1]:   (in /app/app/assets/stylesheets/application.css:12)):

My production config file:

我的生产配置文件:

config.cache_classes = true

config.consider_all_requests_local       = false
config.action_controller.perform_caching = true

config.serve_static_assets = true

config.assets.compress = true

config.assets.compile = true

config.assets.digest = true

Some questions online say to change config.assets.compile to false, but when I do that I get a application.css not precompiled error.

网上有些问题说将config.assets.compile更改为false,但是当我这样做时,我得到一个application.css而不是预编译错误。

3 个解决方案

#1


18  

Taking the line gem jquery-ui-rails out of the assets group in the Gemfile seems to help. Similar problem/fix for the twitter bootstrap gem. :)

从Gemfile中的资产组中取出gem jquery-ui-rails似乎有所帮助。类似的问题/修复twitter bootstrap宝石。 :)

#2


2  

I had a similar, though not identical, problem. In my case, drag and drop methods worked locally, but Heroku complained that it couldn't find jquery-ui.

我有类似但不完全相同的问题。在我的情况下,拖放方法在本地工作,但Heroku抱怨它找不到jquery-ui。

What solved it for me was this:

为我解决的是:

  1. In the Gemfile, added

    在Gemfile中,添加了

    gem 'jquery-ui-rails'

  2. In application.js, added

    在application.js中,添加了

    //= require jquery.ui.all

    // =需要jquery.ui.all

  3. In application.css, added

    在application.css中,添加了

    *= require jquery.ui.all

    * =需要jquery.ui.all

Finally, of course, git commit -a -m "added jquery ui statements", followed by git push heroku master.

最后,当然,git commit -a -m“添加了jquery ui语句”,然后是git push heroku master。

#3


1  

You might have some sort of syntax error in some of your asset files. As the assets are precompiled different types of assets are concatenated as one. Now if one of your CSS files has a syntax error in the end of it, it might not affect anything in our local environment as the assets are not precompiled. However, when the asset files are joint together as one big file anything that then happens to follow the error would not get loaded. This might result in missing JavaScript stuff, CSS rules, etc..

您的某些资产文件中可能存在某种语法错误。由于资产是预编译的,因此将不同类型的资产连接为一个。现在,如果您的一个CSS文件最后有语法错误,它可能不会影响我们本地环境中的任何内容,因为资产未预编译。但是,当资产文件作为一个大文件联合在一起时,任何碰巧跟随错误的内容都不会被加载。这可能会导致缺少JavaScript内容,CSS规则等。

#1


18  

Taking the line gem jquery-ui-rails out of the assets group in the Gemfile seems to help. Similar problem/fix for the twitter bootstrap gem. :)

从Gemfile中的资产组中取出gem jquery-ui-rails似乎有所帮助。类似的问题/修复twitter bootstrap宝石。 :)

#2


2  

I had a similar, though not identical, problem. In my case, drag and drop methods worked locally, but Heroku complained that it couldn't find jquery-ui.

我有类似但不完全相同的问题。在我的情况下,拖放方法在本地工作,但Heroku抱怨它找不到jquery-ui。

What solved it for me was this:

为我解决的是:

  1. In the Gemfile, added

    在Gemfile中,添加了

    gem 'jquery-ui-rails'

  2. In application.js, added

    在application.js中,添加了

    //= require jquery.ui.all

    // =需要jquery.ui.all

  3. In application.css, added

    在application.css中,添加了

    *= require jquery.ui.all

    * =需要jquery.ui.all

Finally, of course, git commit -a -m "added jquery ui statements", followed by git push heroku master.

最后,当然,git commit -a -m“添加了jquery ui语句”,然后是git push heroku master。

#3


1  

You might have some sort of syntax error in some of your asset files. As the assets are precompiled different types of assets are concatenated as one. Now if one of your CSS files has a syntax error in the end of it, it might not affect anything in our local environment as the assets are not precompiled. However, when the asset files are joint together as one big file anything that then happens to follow the error would not get loaded. This might result in missing JavaScript stuff, CSS rules, etc..

您的某些资产文件中可能存在某种语法错误。由于资产是预编译的,因此将不同类型的资产连接为一个。现在,如果您的一个CSS文件最后有语法错误,它可能不会影响我们本地环境中的任何内容,因为资产未预编译。但是,当资产文件作为一个大文件联合在一起时,任何碰巧跟随错误的内容都不会被加载。这可能会导致缺少JavaScript内容,CSS规则等。