postcss-calc 9.0.0 → 9.0.1
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 +1 -2
- package/src/lib/stringifier.js +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-calc",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "PostCSS plugin to reduce calc()",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
},
|
|
30
30
|
"author": "Andy Jansson",
|
|
31
31
|
"license": "MIT",
|
|
32
|
-
"repository": "https://github.com/postcss/postcss-calc.git",
|
|
33
32
|
"eslintConfig": {
|
|
34
33
|
"extends": [
|
|
35
34
|
"eslint:recommended",
|
package/src/lib/stringifier.js
CHANGED
|
@@ -73,12 +73,17 @@ module.exports = function (calc, node, originalValue, options, result, item) {
|
|
|
73
73
|
let str = stringify(node, options.precision);
|
|
74
74
|
|
|
75
75
|
const shouldPrintCalc =
|
|
76
|
-
node.type === 'MathExpression' || node.type === 'Function'
|
|
76
|
+
node.type === 'MathExpression' || node.type === 'Function' ||
|
|
77
|
+
node.type === 'ParenthesizedExpression';
|
|
77
78
|
|
|
78
79
|
if (shouldPrintCalc) {
|
|
79
80
|
// if calc expression couldn't be resolved to a single value, re-wrap it as
|
|
80
81
|
// a calc()
|
|
81
|
-
|
|
82
|
+
if (node.type === 'ParenthesizedExpression') {
|
|
83
|
+
str = `${calc}${str}`;
|
|
84
|
+
} else {
|
|
85
|
+
str = `${calc}(${str})`;
|
|
86
|
+
}
|
|
82
87
|
|
|
83
88
|
// if the warnWhenCannotResolve option is on, inform the user that the calc
|
|
84
89
|
// expression could not be resolved to a single value
|