Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-svgo

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-svgo - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

5

CHANGELOG.md

@@ -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 @@

10

dist/index.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc