postcss-minify-font-values
Advanced tools
Comparing version
@@ -51,3 +51,3 @@ "use strict"; | ||
prepare() { | ||
const cache = {}; | ||
const cache = new Map(); | ||
return { | ||
@@ -65,4 +65,4 @@ OnceExit(css) { | ||
if (cache[cacheKey]) { | ||
decl.value = cache[cacheKey]; | ||
if (cache.has(cacheKey)) { | ||
decl.value = cache.get(cacheKey); | ||
return; | ||
@@ -73,3 +73,3 @@ } | ||
decl.value = newValue; | ||
cache[cacheKey] = newValue; | ||
cache.set(cacheKey, newValue); | ||
}); | ||
@@ -76,0 +76,0 @@ } |
{ | ||
"name": "postcss-minify-font-values", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "Minify font declarations with PostCSS", | ||
@@ -20,3 +20,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"postcss-value-parser": "^4.1.0" | ||
"postcss-value-parser": "^4.2.0" | ||
}, | ||
@@ -28,7 +28,2 @@ "repository": "cssnano/cssnano", | ||
"homepage": "https://github.com/cssnano/cssnano", | ||
"scripts": { | ||
"prebuild": "del-cli dist", | ||
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"", | ||
"prepublish": "yarn build" | ||
}, | ||
"engines": { | ||
@@ -43,3 +38,7 @@ "node": "^10 || ^12 || >=14.0" | ||
}, | ||
"gitHead": "28c247175032fa03f04911cde56ad82d74d211cc" | ||
} | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"" | ||
}, | ||
"readme": "# postcss-minify-font-values [![Build Status][ci-img]][ci]\n\n> Minify font declarations with PostCSS.\n\nThis module will try to minimise the `font-family`, `font-weight` and `font` shorthand\nproperties; it can unquote font families where necessary, detect & remove\nduplicates, and cut short a declaration after it finds a keyword. For more\nexamples, see the [tests](test).\n\n```css\nh1 {\n font:bold 2.2rem/.9 \"Open Sans Condensed\", sans-serif;\n}\n\np {\n font-family: \"Helvetica Neue\", Arial, sans-serif, Helvetica;\n font-weight: normal;\n}\n```\n\n```css\nh1 {\n font:700 2.2rem/.9 Open Sans Condensed,sans-serif\n}\n\np {\n font-family: Helvetica Neue,Arial,sans-serif;\n font-weight: 400;\n}\n```\n\n## API\n\n### minifyFontValues([options])\n\n#### options\n\n##### removeAfterKeyword\n\nType: `boolean`\nDefault: `false`\n\nPass `true` to remove font families after the module encounters a font keyword,\nfor example `sans-serif`.\n\n##### removeDuplicates\n\nType: `boolean`\nDefault: `true`\n\nPass `false` to disable the module from removing duplicated font families.\n\n##### removeQuotes\n\nType: `boolean`\nDefault: `true`\n\nPass `false` to disable the module from removing quotes from font families.\nNote that oftentimes, this is a *safe optimisation* & is done safely. For more\ndetails, see [Mathias Bynens' article][mathias].\n\n## Usage\n\n```js\npostcss([ require('postcss-minify-font-values') ])\n```\n\nSee [PostCSS] docs for examples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n# License\n\nMIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)\n\n[mathias]: https://mathiasbynens.be/notes/unquoted-font-family\n[PostCSS]: https://github.com/postcss/postcss\n[ci-img]: https://travis-ci.org/cssnano/postcss-minify-font-values.svg\n[ci]: https://travis-ci.org/cssnano/postcss-minify-font-values\n" | ||
} |
17037
-3.28%9
-10%Updated