ruby-on-rails – Rails 3.1和链轮使得更难使用firebug进行调试?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails 3.1和链轮使得更难使用firebug进行调试?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在Rails 3.1中,Sprockets用于管理资产并将其打包成单个文件.一般来说,这不是一个坏主意.

从外部来源引用,这解释了现在的问题:

A problem with this approach is that
it could make debugging harder,if you
have to look at the “concatenated” CSS
file in production to make sense of
what code’s included and not,it’s
harder to know what comes from where
than if you just included the original
source code files.

One solution would be to have a way to
switch between “concatenated” and
“normal” modes easily (maybe it’s
already possible,I don’t know),so
that normal development would be
unimpeded. But you’d have to resort to
the big concatenated file for
debugging in production.

在Rails 3.0.X中,我们的设计人员可以使用Firebug轻松引导CSS设置,这将直接指示文件和行号,因为所有的CSS文件都是分开的,而不是打包成一个.

还是我错过了点?

解决方法

我想到最后(当RC越来越接近/成为一个版本),你将能够修改你的config / application.rb与以下
config.assets.css_compressor = false

但是,atm,这并没有真正解决它,因为stylesheet_asset_tag帮助函数与新的管道不完全兼容,所有修饰符都不起作用,所以…

在您的application.html.erb视图中,您将必须链接每个css

<%= stylesheet_link_tag "stylesheets/application" %>
<%= stylesheet_link_tag "stylesheets/foo" %>
<%= stylesheet_link_tag "stylesheets/bar" %>

只要您的config / application.rb中的config.assets.enabled = true,资产的根目录将(默认情况下)/ assets

您可以启动rails控制台(rails c)和p Rails.application.assets以查看可以在同一时间配置的属性.

我同意不是最好的解决方案,但在这一点上(使用RC和稳定版本),这是我发现的最好的方法.

更新:围绕边缘api,发现这个ActionView :: Helper sprockets_stylesheet_link_tag(http://edgeapi.rubyonrails.org/classes/ActionView/Helpers/SprocketsHelper.html),但它似乎仍然是stylesheet_link_tag的不完全替换,因为它没有不支持:所有,您仍然必须在函数调用中拥有样式表/段.就这样说,它的功能越来越多地使用向前移动,所以…

<%= sprockets_stylesheet_link_tag "stylesheets/foo" %>
原文链接:https://www.f2er.com/ruby/272544.html

猜你在找的Ruby相关文章