Are underscores for CSS identifiers and classes in a Rails application a convention?

I have always used hypens in CSS classes and identifiers. I noticed that many Rails plugins (and the Rails core) use underscores. I was wondering is this a convention in a Rails application?

I am confused that the convention follows because I also use the ZURB Foundation gem, which uses hyphens.

+4
source share
3 answers

My enterprise would be that since hyphens are rarely used for variable names, class names, method names, etc., out of habit developers use underscores when naming in HTML and CSS.

I do not believe that in any case there is any agreement. Just a preference.

+1
source

In most editors, the autocomplete function works better if names include underscores rather than hyphens. I think this may be the reason.

+3
source

... think hyphens have mathematical meaning, and underscores don't

0
source

Source: https://habr.com/ru/post/1399119/


All Articles