postcss-discard-unused 8.0.3 → 8.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-discard-unused",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"description": "Discard unused counter styles, keyframes and fonts.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
37
|
-
"url": "cssnano/cssnano"
|
|
37
|
+
"url": "git+https://github.com/cssnano/cssnano.git"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"postcss-selector-parser": "^7.1.5"
|
package/src/index.js
CHANGED
|
@@ -79,7 +79,7 @@ function hasFont(fontFamily, cache, comma) {
|
|
|
79
79
|
* @return {void}
|
|
80
80
|
*/
|
|
81
81
|
function filterFont({ atRules, values }, comma) {
|
|
82
|
-
|
|
82
|
+
const uniqueValues = [...new Set(values)];
|
|
83
83
|
for (const r of atRules) {
|
|
84
84
|
if (r.nodes !== undefined) {
|
|
85
85
|
/** @type {import('postcss').Declaration[]} */
|
|
@@ -95,7 +95,7 @@ function filterFont({ atRules, values }, comma) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
for (const family of families) {
|
|
98
|
-
if (!hasFont(family.value.toLowerCase(),
|
|
98
|
+
if (!hasFont(family.value.toLowerCase(), uniqueValues, comma)) {
|
|
99
99
|
r.remove();
|
|
100
100
|
}
|
|
101
101
|
}
|