amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.87k stars 543 forks source link

fix: account for multi-line comments in tokens, improve comment style #953

Closed jorenbroekema closed 11 months ago

jorenbroekema commented 1 year ago

Issue #, if available:

fixes https://github.com/amzn/style-dictionary/issues/952

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

jorenbroekema commented 1 year ago

I added a second commit with a small change that allows formatting prop to be user-passed, even if the format is css/sass/less/stylus, as well as a small change to allow passing commentStyle "short-above" or "long-above" to ensure the comment is put 1 line above the outputted property, rather then inline next to it.

Let me know if those two things are okay or you prefer it some other way or via a separate PR

chris-dura commented 10 months ago

I added a second commit with a small change that allows formatting prop to be user-passed, even if the format is css/sass/less/stylus, as well as a small change to allow passing commentStyle "short-above" or "long-above" to ensure the comment is put 1 line above the outputted property, rather then inline next to it.

Let me know if those two things are okay or you prefer it some other way or via a separate PR

Should this have documentation updated as well around the additional options for commentStyle?

https://amzn.github.io/style-dictionary/#/formats?id=fileheader


Related, are these types incorrect? The types listed here say the options for commentStyle are "short" | "long" | "none"...

https://github.com/amzn/style-dictionary/blob/0272b8f946bcaef50452af4dc7393b1f559bfdf3/types/FormatHelpers.d.ts#L21

jorenbroekema commented 10 months ago

I added a second commit with a small change that allows formatting prop to be user-passed, even if the format is css/sass/less/stylus, as well as a small change to allow passing commentStyle "short-above" or "long-above" to ensure the comment is put 1 line above the outputted property, rather then inline next to it. Let me know if those two things are okay or you prefer it some other way or via a separate PR

Should this have documentation updated as well around the additional options for commentStyle?

https://amzn.github.io/style-dictionary/#/formats?id=fileheader

Related, are these types incorrect? The types listed here say the options for commentStyle are "short" | "long" | "none"...

https://github.com/amzn/style-dictionary/blob/0272b8f946bcaef50452af4dc7393b1f559bfdf3/types/FormatHelpers.d.ts#L21

Good catch, thanks: https://github.com/amzn/style-dictionary/pull/1047