postcss-svgo
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -0,1 +1,6 @@ | ||
# 1.1.0 | ||
* Adds support for uri-encoded SVG files, for better compatibility | ||
with postcss-svg. | ||
# 1.0.1 | ||
@@ -2,0 +7,0 @@ |
@@ -21,6 +21,9 @@ 'use strict'; | ||
var dataURI = /data:image\/svg\+xml;(charset=)?utf-8,/; | ||
var dataURI = /data:image\/svg\+xml(;(charset=)?utf-8)?,/; | ||
var encode = encodeURIComponent; | ||
var decode = decodeURIComponent; | ||
function minifyPromise(svgo, decl) { | ||
return new Promise(function (resolve, reject) { | ||
var isUriEncoded = decode(decl.value) !== decl.value; | ||
var minify = function minify(_, quote, svg, offset, str, cb) { | ||
@@ -37,7 +40,8 @@ if (!dataURI.test(svg) || !(0, _isSvg2['default'])(svg)) { | ||
} | ||
var o = 'url(' + quote + 'data:image/svg+xml;utf-8,' + result.data + quote + ')'; | ||
var data = isUriEncoded ? encode(result.data) : result.data; | ||
var o = 'url(' + quote + 'data:image/svg+xml;utf-8,' + data + quote + ')'; | ||
return cb(null, o); | ||
}); | ||
}; | ||
(0, _asyncReplace2['default'])(decl.value, /url\(("|')?(.*)\1\)/g, minify, function (err, result) { | ||
(0, _asyncReplace2['default'])(isUriEncoded ? decode(decl.value) : decl.value, /url\(("|')?(.*)\1\)/g, minify, function (err, result) { | ||
decl.value = result; | ||
@@ -44,0 +48,0 @@ resolve(); |
{ | ||
"name": "postcss-svgo", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Optimise inline SVG with PostCSS.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
7195
51