diff --git a/packages/postcss-convert-values/package.json b/packages/postcss-convert-values/package.json index e9df82566..882f10fec 100644 --- a/packages/postcss-convert-values/package.json +++ b/packages/postcss-convert-values/package.json @@ -28,7 +28,7 @@ "repository": "cssnano/cssnano", "dependencies": { "postcss": "^7.0.16", - "postcss-value-parser": "^3.3.1" + "postcss-value-parser": "^4.1.0" }, "bugs": { "url": "https://github.com/cssnano/cssnano/issues" diff --git a/packages/postcss-convert-values/src/__tests__/index.js b/packages/postcss-convert-values/src/__tests__/index.js index fb9031f0d..a221a3189 100644 --- a/packages/postcss-convert-values/src/__tests__/index.js +++ b/packages/postcss-convert-values/src/__tests__/index.js @@ -377,6 +377,13 @@ test( passthroughCSS('h1{top:0\\9\\0;left:0lightyear}') ); +test( + 'should not try to convert keyframe names in animation', + passthroughCSS( + 'h1{ -webkit-animation: e836684w2 } h2{ animation: e836684w2 }' + ) +); + ['stroke-dasharray', 'stroke-dashoffset', 'stroke-width'].forEach( (property) => { test( diff --git a/packages/postcss-convert-values/src/index.js b/packages/postcss-convert-values/src/index.js index b0c7ec3a8..e6c98f325 100644 --- a/packages/postcss-convert-values/src/index.js +++ b/packages/postcss-convert-values/src/index.js @@ -24,7 +24,12 @@ function parseWord(node, opts, keepZeroUnit) { const pair = unit(node.value); if (pair) { const num = Number(pair.number); - const u = pair.unit; + let u = pair.unit; + + if (u[0] === '.') { + u = u.slice(1); + } + if (num === 0) { node.value = keepZeroUnit || (!~LENGTH_UNITS.indexOf(u.toLowerCase()) && u !== '%') diff --git a/packages/postcss-convert-values/yarn.lock b/packages/postcss-convert-values/yarn.lock index 566d20bac..16e251f78 100644 --- a/packages/postcss-convert-values/yarn.lock +++ b/packages/postcss-convert-values/yarn.lock @@ -40,10 +40,10 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= -postcss-value-parser@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" - integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== +postcss-value-parser@^4.1.0: + version "4.1.0" + resolved "https://nexus-new.tcsbank.ru/repository/npm-all/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb" + integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ== postcss@^7.0.16: version "7.0.27"