figma / code-snippet-editor-plugin

Translate component variants, properties, and more into dynamic code snippets for your design system.
https://www.figma.com/community/plugin/1311777988952403297/code-snippet-editor
MIT License
126 stars 11 forks source link

"remove" syntax for string transform #20

Open jake-figma opened 5 months ago

jake-figma commented 5 months ago

A way to remove a substring from a string. Proposed approach would be a second pipe after the filter. This way, the template explicitly states how the input string should be filtered and transformed prior to searching for the substring. This gives template authors a reliable format to match against (they can always use raw filter if they want the original string):

Additionally, we could take the regex-y HTML attribute selector syntax from CSS (^ for "starts with" and $ for "ends with") and supplement with:

mikeysouthwell commented 3 weeks ago

Hey Jake, any update on this? It would be really good if we could transform the string output for this to remove "px" on the end of numbers and also to help break up long-winded strings, such as those for Shadow into more manageable outputs. Currently Shadow for a red drop shadow as an example is:

“0px, 1px, 2px, 0px rgba(208,10,14,0.10)”

It would be good to be able to access each of these values independently and add a string on front of them.