html 类 的双引号
Double Quotation marks for html classes
在使用 Rubocop 时,他们指定在插值以外的可能位置使用单引号而不是双引号。那么 rails 应用程序的视图呢? views中的类写法如下,
<div class="row-fluid">
</div>
这个也要改成单引号吗?这有任何性能变化吗?我只是想知道为什么 Rubocop 更喜欢使用单引号而不是双引号。
TL;DR
- Rubocop 不关心观点。
- HTML 不是 Ruby,因此遵循 HTML.
中的 Ruby 约定甚至没有意义
Should this also be changed to single quotations?
Rubocop 不检查观看次数,所以这取决于您的喜好。
I just want to know why does Rubocop prefer to use single quotation
over double quotation.
Today there is no performance difference 使用 single/double 引号时。
我认为这只是一个品味问题。如果不需要双引号(插值),我更喜欢使用单引号。它恰好是 opinion of the majority of active members of Ruby community.
在使用 Rubocop 时,他们指定在插值以外的可能位置使用单引号而不是双引号。那么 rails 应用程序的视图呢? views中的类写法如下,
<div class="row-fluid">
</div>
这个也要改成单引号吗?这有任何性能变化吗?我只是想知道为什么 Rubocop 更喜欢使用单引号而不是双引号。
TL;DR
- Rubocop 不关心观点。
- HTML 不是 Ruby,因此遵循 HTML. 中的 Ruby 约定甚至没有意义
Should this also be changed to single quotations?
Rubocop 不检查观看次数,所以这取决于您的喜好。
I just want to know why does Rubocop prefer to use single quotation over double quotation.
Today there is no performance difference 使用 single/double 引号时。
我认为这只是一个品味问题。如果不需要双引号(插值),我更喜欢使用单引号。它恰好是 opinion of the majority of active members of Ruby community.