Your SVG optimizer silently broke your icon. Here's the one-line check.
Your SVG optimizer silently broke your icon. Here's the one-line check. I spent an afternoon comparing SVG optimizers on a set of 28 real icons from Simple Icons. The sizes looked fine. Two files made the batch tool crash. Three of them produced a file that opened without complaint, rendered as a blank square, and reported a smaller byte count than the original. The reason: the optimizer had…
Your SVG optimizer may have inadvertently corrupted your icons. An investigation into a set of 28 real icons revealed that the optimizer replaced path coordinates with the invalid string "NaN", causing certain icons to either be blank squares or render incorrectly. This occurred due to the optimizer's handling of arc commands and the optional spacing of flags within them.
The issue was version-dependent, with different optimizers producing varying results when parsing and formatting numbers. A quick "one-line check" using grep to search for the literal string "NaN" within the SVG file can detect this defect. The optimizer's preview may show a seemingly flawless icon, but the downloaded file could be broken.
To safeguard against this, it is recommended to search for "NaN" in the output file before using it, as well as compare the final drawing to the original source at the final display size. This process can help ensure that the replaced icons maintain their intended appearance and functionality.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.