加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 20:03:04 所属栏目:百科 来源:网络整理
导读:在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
在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" %>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读