-
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
Storybook / Demo page SD example for documenting tokens #477
Comments
Looks like we used to have one a while ago, but when we transitioned from 'templates' to 'formats' we didn't include it. You can take a look at the template here: https://github.com/amzn/style-dictionary/blob/main/lib/common/templates/static-style-guide/index.html.template You can use that template in a custom format like this: const fs = require('fs');
const styleDictionary = require('style-dictionary').extend('config.json');
const _ = require('lodash');
const template = _.template( fs.readFileSync('templates/myFormat.template') );
styleDictionary.registerFormat({
name: 'my/format',
formatter: template
}); where |
Also, if anyone wants to provide/update a generic style guide generator, we would be love to merge that in to the codebase |
@didoo @elliotdickison @davixyz @tonyjwalt @7studio @jreichenberg Quick question for some of our biggest contributors: Do you have a favorite example style guide that you would love to see included in SD as a template? Bonus points for any of the following:
Thanks so much for your thoughts... |
Hi, I'm not (yet?) one of your biggest contributors, but I was planning to work this week on a template to generate Storybook stories for my tokens. I'm currently using storybook-design-token to show Design Tokens based on the Sass files generated with Style Dictionary, but it currently shows tokens in a panel in each component, not in their own space. I plan to generate MDX stories with code like that: <ColorPalette>
<ColorItem
title="theme.color.greyscale"
subtitle="Some of the greys"
colors={['#FFFFFF', '#F8F8F8', '#F3F3F3']}
/>
</ColorPalette>
|
+1 to something like a storybook plugin. Maybe not the most beautiful thing ever but capitalizing on a really popular tool like that would be a great start. |
@nhoizey how is your template going? I would love to see what you've built! |
@chazzmoney I just shared something in a related Storybook issue: |
Something I would want/need to see here is somehow including some metadata... Using CTI, I often have |
#1353 is related but does not cover this issue entirely, changing this issue to "enhancement", I definitely think a storybook example would be great. Style Dictionary definitely could output tokens to CSF stories files to get an overview of the tokens. PRs welcome for adding it, see #1344 as a good example |
Hi,
Is there a way to generate a style guide listing all the tokens and how they look? e.g.
https://raw.githubusercontent.com/salesforce-ux/theo/master/assets/doc_example.png
Thanks,
Emma
The text was updated successfully, but these errors were encountered: