资产管道不生成 application.js application.css

发布于 2024-11-28 17:42:12 字数 681 浏览 3 评论 0原文

不确定我做错了什么。但我得到:

 GET http://localhost:3001/assets/application.css 404 (Not Found)

这是我的配置:

gem 'rails', '3.1.0.rc3'              
gem 'rake', '0.9.2'                   
group :assets do
  gem 'sass'
  gem 'coffee-script'
  gem 'uglifier'
  gem 'sprockets'
end

在 application.rb 中:

config.assets.enabled = true

在 app/assets/javascripts/application.js 中:

//= require jquery
//= require jquery_ujs
//= require_tree .

与 app/assets/stylesheets/application.css 类似

为什么不是 /assets/application.[css|js ] 生成/可访问?我需要手动运行一些东西吗?还需要链轮还是现在它是导轨的一部分?

not sure what I'm doing wrong. but I get:

 GET http://localhost:3001/assets/application.css 404 (Not Found)

Here is my config:

gem 'rails', '3.1.0.rc3'              
gem 'rake', '0.9.2'                   
group :assets do
  gem 'sass'
  gem 'coffee-script'
  gem 'uglifier'
  gem 'sprockets'
end

in application.rb:

config.assets.enabled = true

in app/assets/javascripts/application.js:

//= require jquery
//= require jquery_ujs
//= require_tree .

similarly for app/assets/stylesheets/application.css

Why aren't the /assets/application.[css|js] generated/accessible? do I need to run something manually? also is sprockets needed or it's part of rails now?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撩人痒 2024-12-05 17:42:12

这不是您问题的具体答案,但它可能会解决它:我遇到了很多问题,这些问题通过切换到 rc5 得到了解决 - 我注意到在您的 gemfile 中您正在使用 rc3。当我使用 rc4 时,我遇到了很多这样的问题。

一旦执行此操作,您就不再需要在 gemfile 中添加链轮了。另外,你没有提到它,但你的 gemfile 中也有 gem 'jquery-rails' 吗?

It's not a specific answer to your problem, but it might solve it: I ran into a lot of issues which were fixed by switching to rc5 - I notice in your gemfile you're using rc3. I was getting a lot of hiccups like this when I was on rc4.

You don't need to add sprockets in your gemfile anymore once you do this either. Also, you don't mention it but do you have gem 'jquery-rails' in your gemfile too?

听不够的曲调 2024-12-05 17:42:12

正如理查德指出的那样,转向 rc5 有所帮助:

gem 'rails', '3.1.0.rc5'

但我仍然遇到“堆栈级别太深”问题,我最终发现这是由于我的链轮版本(beta.13)造成的,所以我添加了以前版本的 gem 文件:

gem 'sprockets', '2.0.0.beta.12'

和一切正常:)

As Richard pointed out, moving to rc5 helped:

gem 'rails', '3.1.0.rc5'

but I was still getting "stack level too deep" issues which I finally figured out was due to my version of sprockets (beta.13) so I added a previous version the gem file:

gem 'sprockets', '2.0.0.beta.12'

and things are working fine :)

三寸金莲 2024-12-05 17:42:12

我也遇到了这个问题,我花了很多功夫才让它恢复到工作状态。我最终完成的工作是:

  1. 将以下行添加到 application.rb:

    Bundler.require *Rails.groups(:assets) 如果已定义?(Bundler)

  2. 更改我的 Gemfile,以便定义以下内容:

    组:资产

    gem 'sass-rails', "~> 3.1.0.rc"

    gem 'coffee-rails', "~> 3.1.0.rc"

    宝石“丑化者”

    end

  3. 捆绑安装,重新启动我的服务器,瞧,我又拥有了 css 和 js。

I was running into this problem as well and it took me a lot of tinkering to get it back to a working state. What I finally ended up doing that worked is:

  1. Adding the following line to application.rb:

    Bundler.require *Rails.groups(:assets) if defined?(Bundler)

  2. Changing up my Gemfile so that I had the following defined:

    group :assets do

    gem 'sass-rails', "~> 3.1.0.rc"

    gem 'coffee-rails', "~> 3.1.0.rc"

    gem 'uglifier'

    end

  3. Bundle install, relaunch my server and voila, I have css and js again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文