nebulab / erb-formatter

Format ERB files with speed and precision
MIT License
151 stars 25 forks source link

Break class attributes at line width instead of using one class per line #33

Closed elia closed 1 year ago

elia commented 1 year ago

Thanks to @Azeem838 for the pairing session on this feature 🙏

erb-formatter:elia+azeem/single-class-per-line ⤑ be exe/erb-format test/fixtures/multiline_attributes.html.erb                                                                                   ~/C/N/erb-formatter
<button
  class="
    text-gray-700 bg-transparent hover:bg-gray-50 active:bg-gray-100
    focus:bg-gray-50 focus:ring-gray-300 focus:ring-2 disabled:text-gray-300
    disabled:bg-transparent disabled:border-gray-300 disabled:cursor-not-allowed
    aria-disabled:text-gray-300 aria-disabled:bg-transparent
    aria-disabled:border-gray-300 aria-disabled:cursor-not-allowed
  "
>Button</button>
erb-formatter:elia+azeem/single-class-per-line ⤑ be exe/erb-format test/fixtures/multiline_attributes.html.erb --single-class-per-line                                                           ~/C/N/erb-formatter
<button
  class="
    text-gray-700
    bg-transparent
    hover:bg-gray-50
    active:bg-gray-100
    focus:bg-gray-50
    focus:ring-gray-300
    focus:ring-2
    disabled:text-gray-300
    disabled:bg-transparent
    disabled:border-gray-300
    disabled:cursor-not-allowed
    aria-disabled:text-gray-300
    aria-disabled:bg-transparent
    aria-disabled:border-gray-300
    aria-disabled:cursor-not-allowed
  "
>Button</button>
erb-formatter:elia+azeem/single-class-per-line ⤑                                                                                                                                                 ~/C/N/erb-formatter