-
Notifications
You must be signed in to change notification settings - Fork 567
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
Add header to all formats #566
Comments
@lukasoppermann I had to dig a little to do the same thing. The only way I could accomplish this was with |
Hey @brianespinosa, this is great. Since I am using this for a tool that others use, I can't really recommend an unreleased version though. 😢 @dbanksdesign I take it there is no way of "releasing" this feature before version |
@lukasoppermann that is correct. But we should be releasing 3.0.0 pretty soon, just a few more things to finish up. Adding custom data into the header of formats might be cool idea if there is a way we can do it in a generic and flexible way. |
Hey @dbanksdesign that sounds great. I wasn't sure how long it will take until the release (as I know form my own project that OS is always quite a lot of work). I would think allowing users to extend the E.g. in the build.js file // usage
StyleDictionary.formatHelpers.fileHeader.extend([
`Version: ${version}`,
`Some other org specific info`
])
// Would result in (style = short)
// Do not edit directly\n';
// Generated on dd.mm.yyyy
// Version: 2.3.12
// Some other org specific info I don't know if this is a stupid idea as I just quickly dove into the code. But it would be great if one could overwrite or extend the Does this make sense? |
This is a great idea! 👍 It reminds me of #388 (comment) |
Hey @nhoizey, that is definitely were it comes from. The only difference I would love to see, is that we don't have to define a new format for all languages. In my projects I sometimes have to support 4 or more languages. If you have to maintain 4+ separated format extensions it is easy to forget something or introduce errors to one of the formats. Also, if I only want to change the header, it seems wrong to have to define the entire workflow of the format again. |
I would definitely welcome a way to add a header to all formats without any new format definition! 👍 |
@lukasoppermann I love the proposal. I think the only thing I would suggest is if
|
@brianespinosa Either this or it just overwrites all lines, so you can & have to add the default message back, if you want it in there. However if the default message gets more Infos like suggested in #388 exposing the default message would be great |
@dbanksdesign can't we just do it the way we do everything else? Allow registration of formatHelpers / via extend? |
Great idea @chazzmoney! And everyone on this thread! |
@dbanksdesign I just tried this new feature, it's great! 👍 |
This is now in the latest RC build, 3.0.0-rc.7, which you can get with |
@dbanksdesign I cannot, for the life of me, get my custom fileHeader to run inside my custom format. Do you have any examples of exactly that? I can only see examples of custom formats and custom headers, but not both being used together |
Hey @dbanksdesign, I am trying to get the style-dictionary to work with the design token spec idea outlined by the w3c community group: design-tokens/community-group#1
Getting the tokens out works fine in a custom build file like this
However, I would love to add the
version
and maybe some meta data from thedata
constants to the header of every transformed output. It seems to be quite cumbersome to create a custom format withStyleDictionaryExtended.registerFormat
for every language (sass, json, ios, android) just to add a header.So I was wondering, is there a way to add some content to the header for all files?
The text was updated successfully, but these errors were encountered: