Rails 3.2 CSS没有被预编译 [英] Rails 3.2 CSS not being precompiled

查看:76
本文介绍了Rails 3.2 CSS没有被预编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在浏览器We're sorry, but something went wrong.中有一个Rails应用及其抛出错误.我继续检查日志,这就是我得到的:

I have a Rails app and its throwing error in the browser We're sorry, but something went wrong.. I went on to checks on the logs, and this is what i get:

Compiled visitor.js  (0ms)  (pid 15667)
Compiled application.js  (3574ms)  (pid 15667)
Compiled visitor.css  (73ms)  (pid 15667)
Compiled aboutvideos.css  (1ms)  (pid 15667)
Compiled admin.css  (1ms)  (pid 15667)
Compiled bootstrap_and_overrides.css  (802ms)  (pid 15667)
Compiled jquery.fancybox.css  (0ms)  (pid 15667)
Compiled scaffolds.css  (8ms)  (pid 15667)
Compiled stores.css  (1ms)  (pid 15667)
Compiled application.css  (1001ms)  (pid 15667)


Started GET "/" for 190.166.197.58 at 2012-08-25 16:51:44 +0000
Processing by VisitorController#home as HTML
  Rendered visitor/home.html.erb within layouts/application (3.9ms)
Completed 500 Internal Server Error in 131ms

ActionView::Template::Error (visitor.css isn't precompiled):
    3: <head>
    4:   <title><%=h yield(:title) %></title>
    5:   <% if controller_name == "visitor" %>
    6:   <%= stylesheet_link_tag    "visitor", :media => "all" %>
    7:   <%= stylesheet_link_tag    "jquery.fancybox", :media => "all" %>
    8:   <%= javascript_include_tag "visitor" %>
    9:   <%= javascript_include_tag "jquery" %>
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___794713378064579018_17000980'

如您所见,visitor.css正在被编译,那么我得到的错误是visitor.css没有被预编译.我在application.css中包括了* =必需的访问者.怎么了?

As you can see the visitor.css is getting compiled, then i get error that visitor.css isnt precompiled. I have included the *=required visitor in the application.css. What's could be wrong?

推荐答案

如果您在application.css中需要visitor.css(*= require formtastic),则无需自己包含它(<%= stylesheet_link_tag "visitor", :media => "all" %>).

If you require visitor.css (*= require formtastic) within application.css, then you don't need to include it yourself (<%= stylesheet_link_tag "visitor", :media => "all" %>).

如果不这样做,则必须将其添加到production.rb:

If you don't, then you have to add it in your production.rb:

config.assets.precompile += %w( visitor.css )

这篇关于Rails 3.2 CSS没有被预编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆