-
Notifications
You must be signed in to change notification settings - Fork 42
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: add json output format #1513
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
@dstaley I had a quick look at the changes, and I have some thoughts:
|
@didoo Great points! I've refactored the implementation to incorporate your feedback and the patch you sent over (which was super helpful, so thank you!). This new approach adds a |
@dstaley I love your approach, more neat and the code flows better. Let me review the PR "officially" (I've left already a couple of comments in your last commit). |
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.
All good for me. Great work! π
π’
Co-authored-by: Cristiano Rastelli <cristiano.rastelli@hashicorp.com>
@dstaley when you want, you can merge the PR (you don't need more approvals, right? or are there other blockers I am not aware of?) |
π Summary
Adds a new output format that generates a JSON file that can be re-consumed by other Style Dictionary instances.
π οΈ Detailed description
As part of marketing's adoption of HDS, we want to generate a set of tokens that build upon the existing tokens of HDS. There are a handful of instances where we take a color value and perform modifications on it (such as lighten/darken) that are only possible if we have access to the underlying token value. For example:
Currently, we maintain an entire fork of the tokens package to accomplish this, but have realized that if we could pass the HDS tokens into another instance of Style Dictionary, then we could reduce our fork to just our custom tokens.
This PR adds a third output format using the built-in
json
format. For simplicity, it doesn't configure a custom formatter to remove unnecessary properties, but that's a weak opinion loosely held.This JSON file can then be passed into Style Dictionary like so:
This configuration will generate a new set of tokens that have access to the underlying token values from HDS, but won't overwrite them given it uses a different prefix.
πΈ Screenshots
N/A
π External links
HashiCorp Slack link: https://hashicorp.slack.com/archives/C05CBQ2J6J3/p1689625431482409
π Reviewer's checklist:
π¬ Please consider using conventional comments when reviewing this PR.