mini-svg-data-uri
Advanced tools
Comparing version 1.0.3 to 1.1.3
10
index.js
@@ -1,3 +0,3 @@ | ||
const shorterNames = require('./shorter-css-color-names'); | ||
const REGEX = { | ||
var shorterNames = require('./shorter-css-color-names'); | ||
var REGEX = { | ||
whitespace: /\s+/g, | ||
@@ -20,3 +20,3 @@ urlHexPairs: /%[\dA-F]{2}/g, | ||
function colorCodeToShorterNames(string) { | ||
Object.keys(shorterNames).forEach(function(key, i) { | ||
Object.keys(shorterNames).forEach(function(key) { | ||
if (shorterNames[key].test(string)) { | ||
@@ -52,2 +52,6 @@ string = string.replace(shorterNames[key], key); | ||
svgToTinyDataUri.toSrcset = function toSrcset(svgString) { | ||
return svgToTinyDataUri(svgString).replace(/ /g, '%20'); | ||
} | ||
module.exports = svgToTinyDataUri; |
{ | ||
"name": "mini-svg-data-uri", | ||
"version": "1.0.3", | ||
"version": "1.1.3", | ||
"description": "Small, efficient encoding of SVG data URIs for CSS, HTML, etc.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -58,2 +58,12 @@ Mini SVG `data:` URI | ||
* The default output **does not work inside `srcset` attributes**. Use the `.toSrcset` method for that: | ||
```js | ||
var srcsetExample = html` | ||
<picture> | ||
<source srcset="${svgToMiniDataURI.toSrcset(svg)}"> | ||
<img src="${svgToMiniDataURI(svg)}"> | ||
</picture>`; | ||
``` | ||
* The resulting Data URI should be wrapped with double quotes: `url("…")`, `<img src="…">`, etc. | ||
@@ -60,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9022
102
99