Are SVG files to be formatted in a certain way? Like do indentation and line breaks etc. matter to SVG files?
-
SVG defines vector-based graphics in XML format, and XML is based on tags, regardless of their position. You can use spaces, indentations and comments to improve the readability of the file, but an SVG graphic editor or an XML parser will ignore them. See this answer.– Paolo GibelliniNov 5, 2019 at 8:32
1 Answer
No, SVG files are not sensitive to indentation or line breaks. They are sensitive to certain spaces (such as the space between <path
and d
in <path d...
). You can run an SVG through a minifier like SVGOMG and see for yourself that indentation and line breaks are removed.