5 ms·
I think this article is excellent, but one small nit: isn't it contradictory to say don't minimize HTML but do minimize SVG? The justification in the HTML case
by rodw 7y ago
I think this article is excellent, but one small nit: isn't it contradictory to say don't minimize HTML but do minimize SVG?
The justification in the HTML case is that "view source is good" and "it's compressed over the wire anyway". Don't those arguments apply equally (or nearly equally) well to SVG?
- iwalton3 7y agoPrograms such as Inkscape put a lot of extra information into SVG files that is not actually needed for them to render. File size reductions with SVG minifiers can be significant. For instance, the applications-internet.svg icon goes from 31K to 9K when compressing it with svgo.
- setr 7y agoI've never looked into svg specifically but I would assume that even if it's xml, it's generally far from reasonably human readable/editable, in which case you're not losing the properties by minimizing. Unreadable -> more unreadable is much less significant than readable -> unreadable
- rodw 7y agoThat's why I hedged a bit. SVG is certainly less readable, but it can be human readable if not aggressively minimized. I've both created and modified SVG documents by hand with a text editor, and also view-sourced SVGs to see how they work. The only thing that is especially unreadable are the long strings of coordinates that make up paths, and even those can be manageable with comments. No one does complex paths by hand, but the rest is colors, shapes, transforms -- all things you can read and may want to modify.
- sjogress 7y agoSVGs are human readable and human writable. I used SVG as a templating/markup language for years. We were writing software for a specialized, embedded, browser that only understood JS and SVG. It only took a few days of acclimatization to move from writing HTML to writing SVG.
- nrp 7y agoI think the argument is that HTML can and should be human readable and editable, while you really need a tool to meaningfully create and edit SVGs anyway, so minifying isn’t a loss.
- chrismorgan 7y agoDepends on the SVG. I regularly hand-write SVG diagrams. But I won’t claim to be normal!
- madacol 7y agoWhat's the problem with prettifying algorithms?