nebulab / erb-formatter

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

Line length configurable? #49

Closed sharkby7e closed 5 months ago

sharkby7e commented 5 months ago

Couldn't find how to configure line length? Especially annoying with tailwind, want to just keep all class names on same line. Thanks!

elia commented 5 months ago

If you're using erb-formatter from the command line you can pass -h and get the full list of options:

$ erb-formatter -h
Usage: /Users/elia/.asdf/installs/ruby/3.3.0/bin/erb-formatter FILENAME... --write
    -w, --[no-]write                 Write file
        --stdin-filename FILEPATH    Set the stdin filename (implies --stdin)
        --[no-]stdin                 Read the file from stdin
        --print-width WIDTH          Set the formatted output width
        --single-class-per-line      Print each class on a separate line
        --tailwind-output-path PATH  Set the path to the tailwind output file
        --[no-]debug                 Enable debug mode
    -h, --help                       Prints this help
    -v, --version                    Show ERB::Formatter version number and quit

You can use the --print-width option to control line length, e.g. erb-formatter --print-width 120 --write my-file.erb.

Happy to reopen the issue if you need more info 👍

sharkby7e commented 5 months ago

i'm using erb-formatter as a part of conform, and i'm wondering if i can pass the option in through my configuration. I will try that option tho!