Skip to content

Make SVG formatting optional #35

Description

@sairus2k

Description

Prettier does not support formatting SVG files (plugin list, languages on homepage). SVG formatting is not mentioned anywhere. There is an open issue regarding SVG support.

Currently, formatting works through HTML processing, as both HTML and SVG are supersets of XML. This approach seems more like a workaround than proper tool usage.

The generated type files need formatting because any formatter in the project will flag unformatted files. With SVG, there won't be any warnings because neither Prettier nor Biome support SVG, so they won't attempt to format it.

It's highly unlikely that anyone will manually read the generated sprite file, as it is intended only for delivering icons to the browser. The original files can be viewed and formatted if desired using tools like SVGO or SVGOMG.

This will make the file slightly larger. I don't have specific statistics, but for my project, the difference between the generator's version 3.0.1 generated file and the Prettier formatted one is about 10%. For version with pull request #31, the difference will be even greater.

Proposal

I propose to disable SVG formatting or at least make it optional for the following reasons:

  1. SVG is unsupported by both Prettier and Biome.
  2. There's no need to format SVG.
  3. It increases the file size.

Could there be other reasons I might be missing that justify formatting the generated sprite file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions