Skip to content

Last style ignored if no trailing semi-colon #22

@iconifyit

Description

@iconifyit

In CSS, the trailing terminator (semi-colon) is not required for the last rule. In your code, if the last rule is not terminated with a semi-colon it does not get parsed.

For instance:

 '.st5{fill:none;stroke:#45413c;stroke-linecap:round;stroke-linejoin:round}'

Will be parsed to :

{ '.st5': { 
    children: {},
    attributes: { 
        fill: 'none',
        stroke: '#45413c',
        'stroke-linecap': 'round',
        'stroke-linejoin': 'round' 
}}}

Notice that the rule stroke-linejoin:round is missing. However, if I terminate the rule with a semi-colon, it is parse correctly.

Yes, it is easy enough to add the semi-colon but when using the package on auto-generated styles it isn't always possible.

I found a work-around by simply replacing the closing } with ;} to make sure the last rule is always terminated but this is kind of ugly.

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