instance method String#dasherize

View source on GitHub →

String#dasherize() → String

Replaces every instance of the underscore character "_" by a dash "-".

Example
'border_bottom_width'.dasherize();
// -> 'border-bottom-width'
Note

Used in conjunction with String#underscore, String#dasherize converts a DOM style into its CSS equivalent.

'borderBottomWidth'.underscore().dasherize();
// -> 'border-bottom-width'