style-dictionary icon indicating copy to clipboard operation
style-dictionary copied to clipboard

Generating files with same folder/files hierarchy as inputs

Open nhoizey opened this issue 3 years ago • 14 comments

I wanted to generate multiple target files with the same hierarchy of folders and files as my input files in properties/.

I tried to use the matching-build-files example, but it looks like the folder/files hierarchy it builds is mapped on the CTI hierarchy, not the one of the files in which the properties are defined.

I think the two needs can be relevant, and the example provides one of them, while presenting itself as providing also the other.

This is right:

1:1 relationship between build files and token categories

But the title doesn't seem to be:

generate separate build files that match your folder structure

I can:

  • make a PR to change the title of the matching-build-files example, and maybe add some details about the actual use case
  • try to build another example that provides what I currently want, mapping of folders/files instead of CTI

nhoizey avatar May 07 '21 13:05 nhoizey

@kharrop what do you think?

dbanksdesign avatar May 07 '21 17:05 dbanksdesign

That makes total sense! In my example my categories happened to match so I see how that's misleading. An example that matches folder structure would be awesome!

kharrop avatar May 07 '21 23:05 kharrop

Lets do it

dbanksdesign avatar May 08 '21 04:05 dbanksdesign

Ok, I have something that now works well in my project, I will extract an example and open a PR! 👍

nhoizey avatar May 09 '21 09:05 nhoizey

Any relationship to #253 ?

chazzmoney avatar May 10 '21 23:05 chazzmoney

I like #253 a lot!

But it's not directly related, as it deals with input, whereas I'm trying to deal with output.

nhoizey avatar May 11 '21 08:05 nhoizey

I might find time to work on this before the end of the week, should I base my PR on branch main or 3.0(or another)?

nhoizey avatar May 26 '21 19:05 nhoizey

Base it off main

chazzmoney avatar May 27 '21 05:05 chazzmoney

@nhoizey did you ever put together a PR on this? I think other folks are suffering the same challenge and we would love to make it easy on everyone.

chazzmoney avatar Nov 02 '21 22:11 chazzmoney

@chazzmoney I didn't do the PR yet, but I'm still planning to do it. I'll try before the end of next week.

nhoizey avatar Nov 04 '21 08:11 nhoizey

@nhoizey Looking forward to it!

Did you see this example from @dbanksdesign ?

https://stackblitz.com/edit/style-dictionary-example-ykhwa2?file=config.js

chazzmoney avatar Dec 23 '21 00:12 chazzmoney

@nhoizey any progress on your example? facing the same challenge currently

robinscholz avatar Jul 21 '22 08:07 robinscholz

Is this something that is still being worked on?

danciupuliga avatar Jan 24 '24 21:01 danciupuliga

@danciupuliga I will try to provide my configuration today, sorry for the loooong delay.

nhoizey avatar Jan 25 '24 08:01 nhoizey