-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(formats): adding custom file headers #572
Conversation
|
||
const myCustomFormat = ({ dictionary, file }) => { | ||
return `${fileHeader(file, 'short')}${dictionary.allProperties.map(token => { | ||
return `$${token.name}: ${token.value};` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$$
minus the single comment, which I believe is a typo, LGTM! |
docs/api.md
Outdated
| --- | --- | --- | | ||
| options | <code>Object</code> | | | ||
| options.name | <code>String</code> | Name of the format to be referenced in your config.json | | ||
| options.fileHeader | <code>function</code> | Function that returns an array of strings, which will be mapped to comment lines. Takes a single which is the default message array. See [file headers](formats.md#file-headers) for more information. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Takes a single which is
Missing a word in the middle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Takes a single which is the default message array
LGTM! |
Issue #, if available: #566
Description of changes: Adding custom file headers to output files. You can add custom file headers with a register method,
.registerFileHeader
or directly on the Style Dictionary configuration, similar to custom formats. Custom file headers can be used in custom formats as well with theStyleDictionary.formatHelpers.fileHeader()
method.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.