postcss-minify-font-values
Advanced tools
Comparing version
@@ -8,4 +8,2 @@ "use strict"; | ||
var _postcss = _interopRequireDefault(require("postcss")); | ||
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser")); | ||
@@ -44,3 +42,3 @@ | ||
var _default = _postcss.default.plugin('postcss-minify-font-values', opts => { | ||
function pluginCreator(opts) { | ||
opts = Object.assign({}, { | ||
@@ -51,27 +49,39 @@ removeAfterKeyword: false, | ||
}, opts); | ||
return css => { | ||
const cache = {}; | ||
css.walkDecls(/font/i, decl => { | ||
const value = decl.value; | ||
return { | ||
postcssPlugin: 'postcss-minify-font-values', | ||
if (!value) { | ||
return; | ||
} | ||
prepare() { | ||
const cache = {}; | ||
return { | ||
OnceExit(css) { | ||
css.walkDecls(/font/i, decl => { | ||
const value = decl.value; | ||
const prop = decl.prop; | ||
const cacheKey = `${prop}|${value}`; | ||
if (!value) { | ||
return; | ||
} | ||
if (cache[cacheKey]) { | ||
decl.value = cache[cacheKey]; | ||
return; | ||
} | ||
const prop = decl.prop; | ||
const cacheKey = `${prop}|${value}`; | ||
const newValue = transform(prop, value, opts); | ||
decl.value = newValue; | ||
cache[cacheKey] = newValue; | ||
}); | ||
if (cache[cacheKey]) { | ||
decl.value = cache[cacheKey]; | ||
return; | ||
} | ||
const newValue = transform(prop, value, opts); | ||
decl.value = newValue; | ||
cache[cacheKey] = newValue; | ||
}); | ||
} | ||
}; | ||
} | ||
}; | ||
}); | ||
} | ||
pluginCreator.postcss = true; | ||
var _default = pluginCreator; | ||
exports.default = _default; | ||
module.exports = exports.default; |
{ | ||
"name": "postcss-minify-font-values", | ||
"version": "4.0.0-nightly.2020.1.9", | ||
"version": "4.0.0-nightly.2020.1.11", | ||
"description": "Minify font declarations with PostCSS", | ||
@@ -20,4 +20,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"postcss": "^7.0.16", | ||
"postcss-value-parser": "^3.3.1" | ||
"postcss-value-parser": "^4.1.0" | ||
}, | ||
@@ -36,3 +35,9 @@ "repository": "cssnano/cssnano", | ||
"node": ">=10.13.0" | ||
}, | ||
"devDependencies": { | ||
"postcss": "^8.2.1" | ||
}, | ||
"peerDependencies": { | ||
"postcss": "^8.2.1" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15116
1.66%313
2.62%0
-100%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated