资产管道不生成 application.js application.css
不确定我做错了什么。但我得到:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不是您问题的具体答案,但它可能会解决它:我遇到了很多问题,这些问题通过切换到 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?
正如理查德指出的那样,转向 rc5 有所帮助:
但我仍然遇到“堆栈级别太深”问题,我最终发现这是由于我的链轮版本(beta.13)造成的,所以我添加了以前版本的 gem 文件:
和一切正常:)
As Richard pointed out, moving to rc5 helped:
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:
and things are working fine :)
我也遇到了这个问题,我花了很多功夫才让它恢复到工作状态。我最终完成的工作是:
将以下行添加到 application.rb:
Bundler.require *Rails.groups(:assets) 如果已定义?(Bundler)
更改我的 Gemfile,以便定义以下内容:
组:资产
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-rails', "~> 3.1.0.rc"
宝石“丑化者”
end
捆绑安装,重新启动我的服务器,瞧,我又拥有了 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:
Adding the following line to application.rb:
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
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
Bundle install, relaunch my server and voila, I have css and js again.