找不到文件“twitter/bootstrap”生产中
我正在使用 Twitter 的 Bootstrap 翻译为 SCSS 文件。它可以在本地开发中工作,但是当我预编译并推送到 Heroku(使用 Cedar 堆栈)时,我得到:
> Started GET "/" for 74.57.16.130 at 2012-01-28 17:16:36 +0000
> Processing by StaticPagesController#home as HTML Rendered
> static_pages/home.html.erb within layouts/application (0.7ms)
> Completed 500 Internal Server Error in 4ms
>
> ActionView::Template::Error (couldn't find file 'twitter/bootstrap'
> (in /app/app/assets/stylesheets/application.scss.css:11)):
> 8: </head>
> 6: <%= javascript_include_tag "application" %>
> 4: <title><%= full_title(yield(:title)) %></title>
> 2: <html>
> 5: <%= stylesheet_link_tag "application", :media => "all" %>
app/views/layouts/application.html.erb:5:in
> `_app_views_layouts_application_html_erb___288948710373692320_32137840'
> 3: <head> cache: [GET /] miss
>
> 7: <%= csrf_meta_tags %> cache: [GET /favicon.ico] miss
我使用的是 Rails 3.2.0,该应用程序一直在 Heroku 上运行,直到我添加 SASS 文件。
I'm using Twitter's Bootstrap translated to SCSS files. It works in local-development, but when I precompile and push to Heroku (using Cedar stack), I get this:
> Started GET "/" for 74.57.16.130 at 2012-01-28 17:16:36 +0000
> Processing by StaticPagesController#home as HTML Rendered
> static_pages/home.html.erb within layouts/application (0.7ms)
> Completed 500 Internal Server Error in 4ms
>
> ActionView::Template::Error (couldn't find file 'twitter/bootstrap'
> (in /app/app/assets/stylesheets/application.scss.css:11)):
> 8: </head>
> 6: <%= javascript_include_tag "application" %>
> 4: <title><%= full_title(yield(:title)) %></title>
> 2: <html>
> 5: <%= stylesheet_link_tag "application", :media => "all" %>
app/views/layouts/application.html.erb:5:in
> `_app_views_layouts_application_html_erb___288948710373692320_32137840'
> 3: <head> cache: [GET /] miss
>
> 7: <%= csrf_meta_tags %> cache: [GET /favicon.ico] miss
I'm using Rails 3.2.0, the app was working on Heroku until I added the SASS files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在 config/environments/production.rb 中添加以下行:
config.assets.precompile = [/^[-_a-zA-Z0-9]*\..*/]
我的猜测是它没有添加您的所有资产。
In
config/environments/production.rb
add this line:config.assets.precompile = [/^[-_a-zA-Z0-9]*\..*/]
My guess is it is not adding all your assets.
这解决了heroku中的问题至少
只是降级到sass-rails 3.1.4
this solved the issue in heroku at least
just downgrade to sass-rails 3.1.4
当您将 Rails 应用程序部署到 heroku.com 时看到类似的内容时,
只需将其添加到 config/application.rb 中
When you see something like this when you are deploying rails app to heroku.com
Just add this to config/application.rb
确保在 config/environments/production.rb 中,您有...
Make sure, in config/environments/production.rb, you have...
你用的是宝石吗?确保您的 gem 不属于资产组,并且可以在生产中访问。
来自 GemFile
因此,只需将 gem 移到任何组之外就可以了。
Are you using a gem? Make sure your gem is not part of the assets group and is accessible in production.
From GemFile
So just move the gem outside of any group and you should be okay.
只需将其放入您的 gemfile
BootStrap 2.0 中的 CSS 无效 会导致 SCSS 编译
失败可以通过查看输出来验证这一点,
您应该看到一些错误,例如:
Just put this in your gemfile
There's invalid CSS in BootStrap 2.0 which causes SCSS compilation to fail
You can verify this by looking at the output of
You should see some error like: