amzn / style-dictionary

A build system for creating cross-platform styles.
https://amzn.github.io/style-dictionary/#/
Apache License 2.0
3.77k stars 527 forks source link

Using curly braces {} for templating content #334

Open custa1200 opened 4 years ago

custa1200 commented 4 years ago

One of the consumers of our system uses curly braces for content replacement in strings.

Due to the way that SD currently uses curly braces in the build process there is no way I can have a string that includes the braces for consumption.

I have tried a number of ways to escape the braces with no luck

Other languages and templating systems seem to use the concept of using double curly braces to handle this scenario.

It could be a way that SD could also handle it but am open to anything else that would allow the scenario to be achieved

e.g. screenHeadingContent: {value: "Welcome's to the {{0}} screen"}

would build to

screenHeadingContent: "Welcome's to the {0} screen"

iadeelzafar commented 4 years ago

🙌 Hi @dbanksdesign @custa1200 ,

I'm new to this repository. I'd like to take on this issue. If you guys could give me more context on how this could be resolved - that'd be great!

Thanks!

custa1200 commented 4 years ago

For further example if the consumer using function arguments with curly braces can be found at: http://www.zingstudio.io/doc/String.html#function-arg-any-value-→-string

Let me know if you want any other info

iadeelzafar commented 4 years ago

@custa1200 I get the idea that you're suggesting here but I'm a little confused on how and where to start implementing this in this repository/code. Since I'm new to this Style Dictionary repository.

creatorpiyush commented 4 years ago

Can I take this issue if no one is working on it?

dbanksdesign commented 4 years ago

@creatorpiyush absolutely! (sorry for the delayed response) 🐌

hmalaud commented 2 years ago

Hello guys, how are things going on this topic?

dbanksdesign commented 2 years ago

@hmalaud nothing so far, if anyone wants to open a PR for this though we can review it.

himanshututeja1998 commented 1 year ago

Is this issue closed? If not can u please help me with some summary. I can contribute here

jorenbroekema commented 2 months ago

Considering that { . } are now all reserved characters from the perspective of the DTCG draft spec, I'm not sure if we still want this kind of customizability in style-dictionary. Removing the labels at least for now.