Closed apackin closed 3 hours ago
The current behavior isn't correct and should be fixed
The current behavior isn't correct and should be fixed
- Is a trailing ";" valid syntax? It feels like a leftover css-ism.
It's automatically included in the export when our designer adds the gradient from the GUI that references a sibling token set. I'm not familiar with the inner workings or intentions of the figma token exporter.. is that open source too?
- Should the parsing fail if it isn't valid?
Yes, I agree that the silent failing is also an issue. Added a 👍 to https://github.com/mark-nicepants/figma2flutter/issues/20.
Our designer was able to remove the trailing ;
in the GUI
PR Description
Fixes Issue: Incorrect Parsing of Linear Gradients with Trailing Semicolons
Issue
Some of the
linear-gradient
values in our JSON contain a trailing semicolon. For example:"value": "linear-gradient(45deg, #ffffff 0%, #000000 100%);"
"value": "linear-gradient(45deg, #ffffff 0%, #000000 100%)"
When this occurs, the
DimensionValue._parseNum
function receives"100%)"
, resulting in it returning0
.Solution
This PR introduces a change that identifies and removes trailing semicolons (
;
) fromlinear-gradient
values, ensuring correct parsing. It maintains the existing stripping of trailing)
in either case.