Skip to content

Negative values are serialized with double negative signs #2

Open

Description

@ryelle

I noticed that negative values are re-encoded with double-negative signs, which breaks the bidirectional conversions for full CSS. For example, trying to parse and re-serialize .card { margin: -1rem }:

require 'minicss'
root = MiniCSS.parse(".card { margin: -1rem }")
puts MiniCSS.serialize(root)

This outputs .card { margin: --1rem }

I think it's because the Number's value is -1.0 and the sign is -, so when the serializer processes it, it outputs both the - string and the - from the negative value.

Activity

  1. heyvito commented on Feb 23, 2026

    @heyvito
    Owner

    Hi Kelly, thank you for reporting the issue.
    I'll be able to take a look in a few days. If you don’t mind me asking, is this currently blocking you? Asking so I can reprioritise it among my other tasks.

  2. ryelle commented on Feb 25, 2026

    @ryelle
    Author

    I can work around it while I'm prototyping, and the project isn't my highest priority right now, so no immediate rush. It would be a blocker for the final product if I do end up shipping it though.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions