{"name":"mini-svg-data-uri","version":"1.1.3","description":"Small, efficient encoding of SVG data URIs for CSS, HTML, etc.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/tigt/mini-svg-data-uri.git"},"keywords":["svg","url","data","uri","minification","url encoding"],"author":{"name":"Taylor “Tigt” Hunt","email":"holla@ti.gt","url":"https://ti.gt/"},"license":"MIT","bugs":{"url":"https://github.com/tigt/mini-svg-data-uri/issues"},"homepage":"https://github.com/tigt/mini-svg-data-uri#readme","gitHead":"5e043dfc74cc7b93e4a805bae74350b5b2a61623","_id":"mini-svg-data-uri@1.1.3","_nodeVersion":"11.9.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-EeKOmdzekjdPe53/GdxmUpNgDQFkNeSte6XkJmOBt4BfWL6FQ9G9RtLNh+JMjFS3LhdpSICMIkZdznjiecASHQ==","shasum":"9759ee5f4d89a4b724d089ce52eab4b623bfbc88","tarball":"http://registry-npm.ywwl.com/mini-svg-data-uri/download/mini-svg-data-uri-1.1.3.tgz","fileCount":5,"unpackedSize":9022,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdG+fqCRA9TVsSAnZWagAAoKoP/3Pb01E3/5VbDIaBr78d\n8DE8RJUBIOMTbzLd8T282WKi00H+OM1IWbFOLIIVwQBDaOJ8YWB+oAOb+jGq\nb2G+JiGYEVdQEc9osSI87R44R1w4y6+dHDANu6VO2afXO1zpQEyribwJ89tA\ni+TUU0clHDi8wd8G7k2OMqzWneb2z5UuzvTxsuk+b2Cf/Cyn7B7alS9ZUlHJ\nAx6Txl9a2TfOPH5ukeznN2gPBWuQamnkr3iKZEIVVcudOzhMprhbbIrODAX5\nKDVz3LR2GheJd/XEHdOrG0T203pEahUSpAl8v2DH0/oFR8blKQB1/pbInBw8\nKxZOx/+oI3hAQVeDqBQwwHoTA+ManHlh7doattTTImDlVT++itn2Jnkm4BEF\nYJYPwpfaJWbzMTBsrupAO9bkNmyA9ZoaFmLctaCfPnQgrdwx9BeDNqrfmE8Q\nOukCJS33PYvXedDDaJtledFQJ3k/Kz9mwGXVbdRBol3EiuhBgZ4KbPCRly7/\ng1g4M7BF9/LbJTkX9n/fGK/bEodrj7/+Kdwrp0N0LWWhG8akAeeipmpHBjRM\ngxUhfDUNkiTKpzAs3PJWvw2KNRRm1Ci082aMjP4TjKHyo0cxchmaEWgl9V7q\nXJjWz5JZvUy3Mba0SmtiufS1W2X1K4boA9es795bPVpliifKhwiwVu8hB4Ar\n8B+y\r\n=ZFSn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFTn1E6/gJAlLIOM9aejwRs4ZnOea9ykMT3tEeanOENqAiB+LNnnBNC1yP/PkfM0/n9DnG/CtBPoaHejqe3h/EACNQ=="}],"size":4278,"noattachment":false,"key":"/mini-svg-data-uri/-/mini-svg-data-uri-1.1.3.tgz"},"maintainers":[{"name":"tigt","email":"npm@ti.gt"}],"_npmUser":{"name":"tigt","email":"npm@ti.gt"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mini-svg-data-uri_1.1.3_1562109929948_0.19904511672420733"},"_hasShrinkwrap":false,"readme":"Mini SVG `data:` URI\n====================\n\nThis tool converts SVGs into the most compact, compressible `data:` URI that SVG-supporting browsers tolerate. The results look like this (169 bytes):\n\n```url\ndata:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'\n%3e%3cpath d='M22 38V51L32 32l19-19v12C44 26 43 10 38 0 52 15 49 39 22 38z'/%3e\n%3c/svg%3e\n```\n\nCompare to the Base64 version (210 bytes):\n\n```url\ndata:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIH\nZpZXdCb3g9IjAgMCA1MCA1MCI+PHBhdGggZD0iTTIyIDM4VjUxTDMyIDMybDE5LTE5djEyQzQ0IDI2ID\nQzIDEwIDM4IDAgNTIgMTUgNDkgMzkgMjIgMzh6Ii8+PC9zdmc+\n```\n\nOr the URL-encoded version other tools produce (256 bytes):\n\n```url\ndata:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%\n2F2000%2Fsvg%22%20viewBox%3D%220%200%2050%2050%22%3E%3Cpath%20d%3D%22M22%2038V51\nL32%2032l19-19v12C44%2026%2043%2010%2038%200%2052%2015%2049%2039%2022%2038z%22%2\nF%3E%3C%2Fsvg%3E\n```\n\nFor a more realistic example, I inlined the icons from the [Open Iconic](https://useiconic.com/open) project into CSS files with the 3 above methods:\n\n| Compression | Base64    | Basic %-encoding | `mini-svg-data-uri` |\n|-------------|----------:|-----------------:|--------------------:|\n| None        | 96.459 kB | 103.268 kB       | 76.583 kB           |\n| `gzip -9`   | 17.902 kB | 13.780 kB        | 12.974 kB           |\n| `brotli -Z` | 15.797 kB | 11.693 kB        | 10.976 kB           |\n\nRoughly 6% smaller compressed, but don't write off the ≈20% uncompressed savings either. [Some browser caches decompress before store](https://blogs.msdn.microsoft.com/ieinternals/2014/10/21/compressing-the-web/), and parsing time/memory usage scale linearly with uncompressed filesize.\n\n\nUsage\n-----\n\n```js\nvar svgToMiniDataURI = require('mini-svg-data-uri');\n\nvar svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M22 38V51L32 32l19-19v12C44 26 43 10 38 0 52 15 49 39 22 38z\"/></svg>';\n\nvar optimizedSVGDataURI = svgToMiniDataURI(svg);\n// \"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3e%3cpath d='M22 38V51L32 32l19-19v12C44 26 43 10 38 0 52 15 49 39 22 38z'/%3e%3c/svg%3e\"\n```\n\nYou can also [try it in your browser at RunKit](https://npm.runkit.com/mini-svg-data-uri).\n\n### CLI\n\nIf you have it installed globally, or as some kind of dependency inside your project’s directory:\n\n```sh\nmini-svg-data-uri file.svg # writes to stdout\nmini-svg-data-uri file.svg file.svg.uri # writes to the given output filename\n```\n\nUse `--help` for more info.\n\n### Warning\n\n* This **does not optimize the SVG source file**. You’ll want [svgo](https://github.com/svg/svgo) or its brother [SVGOMG](https://jakearchibald.github.io/svgomg/) for that.\n\n* The default output **does not work inside `srcset` attributes**. Use the `.toSrcset` method for that:\n\n  ```js\n  var srcsetExample = html`\n  <picture>\n    <source srcset=\"${svgToMiniDataURI.toSrcset(svg)}\">\n    <img src=\"${svgToMiniDataURI(svg)}\">\n  </picture>`;\n  ```\n\n* The resulting Data URI should be wrapped with double quotes: `url(\"…\")`, `<img src=\"…\">`, etc.\n\n* This might change or break SVGs that use `\"` in character data, like inside `<text>` or `aria-label` or something. Try curly quotes (`“”`)  or `&quot;` instead.\n\n\nFAQ\n---\n\n### Don’t you need a `charset` in the MIME Type?\n\n`charset` does nothing for Data URIs. The URI can only be the encoding of its parent file — it’s included in it!\n\n### Why lowercase the URL-encoded hex pairs?\n\nIt compresses slightly better. No, really. Using the same files from earlier:\n\n| Compression | Uppercase (`%AF`) | Lowercase (`%af`) |\n|-------------|------------------:|------------------:|\n| `gzip -9`   | 12.978 kB         | 12.974 kB         |\n| `brotli -Z` | 10.988 kB         | 10.976 kB         |\n\nI did say *slightly*.\n\n\nBrowser support\n---------------\n\n* Internet Explorer 9 and up, including Edge\n* Firefox, Safari, Chrome, whatever else uses their engines\n* Android WebKit 3+\n* Opera Mini’s server-side Presto\n","publish_time":1562109930055,"_cnpm_publish_time":1562109930055,"dist-tags":{"latest":"1.4.4"}}