7 ms·
that's a lot of svg! svgo suggests the following without any manual tinkering: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path fill="#F60
by 5- 3y ago
that's a lot of svg! svgo suggests the following without any manual tinkering:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path fill="#F60" d="M0 0h100v100H0z"/><path fill="none" stroke="#FFF" stroke-width="8.79" d="M50 77V50m23.69-35.62L50 50M26.47 14.45l23.25 35.62"/><path fill="#F60" d="M0 0h100v23.74H0z"/></svg>
- willis936 3y agoTransport compression should get it most of the way there, no? I think having human readable vector graphics is nice.
- kashnote 3y agoThis the most HN string of replies I've seen. Cheers haha
- h0l0cube 3y agoApart from being one-lined, the optimised version is more readable and roughly about as compressible. There’s really no reason to have transformation matrices for 2 squares and a simple polygon
- tomxor 3y agotransport compression isn't going to help with the unnecessary high precision coordinates. There are also a bunch of things that are just the result of it being automatically generated by some vector package, such as the transforms, separate paths, masking of a bunch of strokes rather than just flattening the shape etc.
- tomxor 3y agoI see your 258 byte svgo version and raise it my 171 byte hand optimized version: <svg viewBox="-32 -32 64 64" xmlns="http://www.w3.org/2000/svg"><path fill="#f60" d="M-32-32h64v64h-64z"/><path fill="#fff" d="m0-5l-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
- tomxor 3y agoBetter still, an inline SVG fragment is only 151 bytes - and will save 318 bytes of http header: <svg viewBox="-32 -32 64 64" width=18 height=18><path fill=#f60 d="M-32-32h64v64h-64z"/><path fill=#fff d="m0-5l-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
- turnsout 3y ago118, can we beat it anyone? <svg viewBox="-32 -32 64 64" style="background: #f60"><path fill="#fff" d="m0-5l-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
- lights0123 3y agoIt doesn't need to be valid XML if you embed it in the HTML, which was their point.
- turnsout 3y agoEdit: I stand corrected, it does parse correctly when embedded in HTML!
- zimpenfish 3y agoBy the tiniest of margins, 115. Deleted two spaces and an `l`. Largely inspired by `svgo`. Using `rsvg-convert` to render them both to PNG shows identical output between this and the 118 version. https://rjp.is/hn-svg.html https://rjp.is/hn-svg.html seems to render them identically in Safari and Chrome. <svg viewBox="-32-32 64 64" style="background:#f60"><path fill="#fff" d="m0-5-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
- Squarex 3y agoBut not in Firefox :(
- zimpenfish 3y ago