Skip to content

incorrect removal of whitespace with 'px' and '+' in max (and probably calc) #17

@eoghanmurray

Description

@eoghanmurray
(.virtual) :~/test$ pip install csscompressor
Collecting csscompressor
  Downloading csscompressor-0.9.5.tar.gz (237 kB)
...
  Created wheel for csscompressor: filename=csscompressor-0.9.5-py3-none-any.whl size=240407 sha256=c46201c4d27dfd191c24efc04cfe00367005d3b6799580bd09891e3eacacd103
...
Successfully built csscompressor
Installing collected packages: csscompressor
Successfully installed csscompressor-0.9.5
(.virtual) :~/test$  python
Python 3.13.3 (main, Aug 14 2025, 11:53:40) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import csscompressor; csscompressor.__version__
'0.9.4'
>>> import csscompressor; csscompressor.compress('max(-8px, 12px + (800px - 100vw) / 30)')
'max(-8px,12px+(800px - 100vw) / 30)'

Note: I believe the library is incorrectly reporting an earlier library version; 0.9.4 instead of 0.9.5.

Expected output:
'max(-8px,12px +(800px - 100vw) / 30)'

The px+ is invalid CSS and causes the whole rule to fail in Firefox at least

Workaround is to do compressed_css = compressed_css.replace('px+', 'px +')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions