Open zackphilipps opened 1 year ago
This line is the culprit: https://github.com/amzn/style-dictionary/blob/6182d63765b86b19a83d27eeee227d5b0b9ea4ee/lib/common/formatHelpers/createPropertyFormatter.js#L131
So, it appears that the asset/swift/literal
transform is not necessary. A workaround is replacing transformGroup: "ios-swift",
with this:
transforms: [
"attribute/cti",
"name/cti/camel",
"color/UIColorSwift",
"content/swift/literal",
"size/swift/remToCGFloat",
"font/swift/literal"
],
Closing the loop here, I still needed a transform to wrap all strings in "
, some of which didn't fall within asset
, content
, or font
categories. Here's what I wrote; maybe someone else will find it useful.
StyleDictionary.registerTransform({
name: "value/swift/literal",
type: "value",
matcher: function (token) {
return (
!["color", "size", "asset"].includes(token.attributes.category) &&
typeof token.value === "string"
);
},
transformer: function (token) {
return `"${String(token.original.value).replace(/"/g, "'")}"`;
},
});
Given the following config:
I'm seeing this output: