nebulab / erb-formatter

Format ERB files with speed and precision
MIT License
135 stars 22 forks source link

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

Closed elia closed 9 months ago

elia commented 9 months 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