Socket
Socket
Sign inDemoInstall

postcss-url

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-url - npm Package Compare versions

Comparing version 7.1.0 to 7.1.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 7.1.0 - 2017-07-24
Fixed: force wrap url by quotes for `optimizeSvgEncode` ([#105](https://github.com/postcss/postcss-url/issues/105))
# 7.1.0 - 2017-07-19

@@ -2,0 +6,0 @@

2

package.json
{
"name": "postcss-url",
"version": "7.1.0",
"version": "7.1.1",
"description": "PostCSS plugin to rebase or inline on url().",

@@ -5,0 +5,0 @@ "keywords": [

@@ -26,2 +26,4 @@ 'use strict';

const WITH_QUOTES = /^['"]/;
/**

@@ -124,3 +126,10 @@ * Restricted modes

return newUrl ? `${before}${newUrl}${after}` : matched;
if (!newUrl) return matched;
if (WITH_QUOTES.test(newUrl) && WITH_QUOTES.test(after)) {
before = before.slice(0, -1);
after = after.slice(1);
}
return `${before}${newUrl}${after}`;
});

@@ -127,0 +136,0 @@ };

@@ -19,3 +19,3 @@ 'use strict';

//
// Lowercase the hex-escapes for better gzipping
return result.replace(/(%[0-9A-Z]{2})/g, (matched, AZ) => {

@@ -34,3 +34,3 @@ return AZ.toLowerCase();

module.exports = (file, encodeType, shouldOptimizeURIEncode) => {
module.exports = (file, encodeType, shouldOptimizeSvgEncode) => {
const dataMime = `data:${file.mimeType}`;

@@ -48,3 +48,3 @@

let encodedStr = (shouldOptimizeURIEncode && encodeType === 'encodeURIComponent')
let encodedStr = (shouldOptimizeSvgEncode && encodeType === 'encodeURIComponent')
? optimizedSvgEncode(content)

@@ -51,0 +51,0 @@ : encodeFunc(content);

@@ -79,5 +79,10 @@ 'use strict';

const encodedStr = encodeFile(file, encodeType, options.optimizeSvgEncode && isSvg);
const optimizeSvgEncode = isSvg && options.optimizeSvgEncode;
const encodedStr = encodeFile(file, encodeType, optimizeSvgEncode);
const resultValue = options.includeUriFragment && asset.hash
? encodedStr + asset.hash
: encodedStr;
return (options.includeUriFragment && asset.hash) ? encodedStr + asset.hash : encodedStr;
// wrap url by quotes if optimized svg
return optimizeSvgEncode ? `"${resultValue}"` : resultValue;
};
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