Skip to content

[Bug]: Issue with unitless zero, starting with 11.2.0 #328

Description

@bazineta

Describe the bug

Deep in the bowels of bootstrap's CSS, there's code that produces this:

padding:calc(.375rem - 1px - 0) .75rem calc(.375rem - 1px - 3px - 0)

The 11.1.2 release does not complain about this, but starting in 11.2.0, and continuing in 11.2.1, the following warning is issued:

Invalid CSS calculation type

I suspect it's not dealing with the unitless zero in the calculation in the same way it did previously.

Expected behaviour

I expect this to not issue a warning, and instead to determine that zero is....zero, and therefore uninteresting.

Steps to reproduce

Using this minimal repro:

.x {
  padding: calc(.375rem - 1px - 0);
}

Will, under 11.1.2, produce:

x {
  padding: calc(.375rem - 1px);
}

Using 11.2.0 or 11.2.1, it will instead produce:

Invalid CSS calculation type

Version

11.2.1

Environment

System:
    OS: macOS 26.7
    CPU: (16) arm64 Apple M3 Max
    Memory: 8.04 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh

Package details

├─┬ autoprefixer@10.6.1
│ └── postcss@8.5.28 deduped
├─┬ css-loader@7.1.5
│ ├─┬ icss-utils@5.1.0
│ │ └── postcss@8.5.28 deduped
│ ├─┬ postcss-modules-extract-imports@3.1.0
│ │ └── postcss@8.5.28 deduped
│ ├─┬ postcss-modules-local-by-default@4.2.0
│ │ └── postcss@8.5.28 deduped
│ ├─┬ postcss-modules-scope@3.2.1
│ │ └── postcss@8.5.28 deduped
│ ├─┬ postcss-modules-values@4.0.0
│ │ └── postcss@8.5.28 deduped
│ └── postcss@8.5.28 deduped
├─┬ cssnano@9.0.5
│ ├─┬ cssnano-preset-default@9.0.5
│ │ ├─┬ cssnano-utils@7.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-calc@11.2.1
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-colormin@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-convert-values@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-discard-comments@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-discard-duplicates@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-discard-empty@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-discard-overridden@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-merge-longhand@9.0.4
│ │ │ ├── postcss@8.5.28 deduped
│ │ │ └─┬ stylehacks@9.0.4
│ │ │   └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-merge-rules@9.0.4
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-minify-font-values@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-minify-gradients@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-minify-params@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-minify-selectors@9.0.4
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-charset@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-display-values@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-positions@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-repeat-style@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-string@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-timing-functions@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-unicode@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-url@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-normalize-whitespace@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-ordered-values@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-reduce-initial@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-reduce-transforms@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-svgo@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ ├─┬ postcss-unique-selectors@9.0.3
│ │ │ └── postcss@8.5.28 deduped
│ │ └── postcss@8.5.28 deduped
│ └── postcss@8.5.28 deduped
├─┬ postcss-loader@8.2.1
│ └── postcss@8.5.28 deduped
├── postcss@8.5.28
└─┬ resolve-url-loader@5.0.0
  └── postcss@8.5.28 deduped

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions