Skip to content

Negative values are serialized with double negative signs #2

@ryelle

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.

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