postcss / postcss-calc

PostCSS plugin to reduce calc()
MIT License
212 stars 34 forks source link

[Bug]: `calc` disappears if extra pair of parentheses around the argument #181

Closed ludofischer closed 1 year ago

ludofischer commented 1 year ago

Describe the bug

If you add an extra pair of parentheses around the argument to the calc function, postcss-calc removes the calc token. For example: calc((var(--circumference) / var(--number-of-segments))) turns into (var(--circumference) / var(--number-of-segments))

Expected behaviour

calc should stay and the extra parentheses disappear:

calc((var(--circumference) / var(--number-of-segments))) turns into calc(var(--circumference) / var(--number-of-segments))

Steps to reproduce

See https://github.com/postcss/postcss-calc/pull/180

Version

8.2.4

Environment

System:
    OS: Linux 6.2 Fedora Linux 38 (Workstation Edition)
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
    Memory: 27.19 GB / 30.17 GB
    Container: Yes
    Shell: 3.6.1 - /usr/bin/fish

Package details

postcss-calc@8.2.4 /home/ludovico/projects/scratch/postcss-calc
├─┬ postcss-selector-parser@6.0.9 -> ./node_modules/.pnpm/postcss-selector-parser@6.0.9/node_modules/postcss-selector-parser
│ └── postcss@8.4.5 deduped -> ./node_modules/.pnpm/postcss@8.4.5/node_modules/postcss
└── postcss@8.4.5 -> ./node_modules/.pnpm/postcss@8.4.5/node_modules/postcss

Additional context

Originally submitted on the cssnano repository: https://github.com/cssnano/cssnano/issues/1490