-
Notifications
You must be signed in to change notification settings - Fork 0
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
Reformat typography tokens #13
Changes from all commits
7d4060e
0dcd428
a59352d
9350fcc
71e8ed1
0a857d4
b1b205f
e2cbc42
ce83981
ff76b00
563f8d3
7ccadcc
81afb7a
506f971
d0d09ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const StyleDictionary = require("style-dictionary").extend("config.json"); | ||
|
||
StyleDictionary.registerFilter({ | ||
name: "filter-typography", | ||
matcher: ({ attributes }) => { | ||
return attributes.type === "typography"; | ||
}, | ||
}); | ||
|
||
StyleDictionary.extend({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extending the |
||
platforms: { | ||
Owlery: { | ||
transformGroup: "scss", | ||
buildPath: "build/scss/", | ||
files: [ | ||
{ | ||
destination: "colors.scss", | ||
format: "scss/variables", | ||
filter: { | ||
type: "color", | ||
}, | ||
}, | ||
{ | ||
destination: "typography.scss", | ||
format: "scss/variables", | ||
filter: "filter-typography", | ||
}, | ||
], | ||
}, | ||
|
||
Aviary: { | ||
transformGroup: "js", | ||
buildPath: "build/ts/", | ||
files: [ | ||
{ | ||
format: "javascript/es6", | ||
destination: "colors.ts", | ||
filter: { | ||
type: "color", | ||
}, | ||
}, | ||
{ | ||
format: "javascript/es6", | ||
destination: "typography.ts", | ||
filter: "filter-typography", | ||
}, | ||
], | ||
}, | ||
}, | ||
}).buildAllPlatforms(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,68 @@ | ||
|
||
// Do not edit directly | ||
// Generated on Wed, 15 Jun 2022 15:44:11 GMT | ||
// Generated on Thu, 16 Jun 2022 19:25:52 GMT | ||
|
||
$global-typography-h1: [object Object]; | ||
$global-typography-h2: [object Object]; | ||
$global-typography-h3: [object Object]; | ||
$global-typography-h4: [object Object]; | ||
$global-typography-h5: [object Object]; | ||
$global-typography-body: [object Object]; | ||
$global-typography-footnote: [object Object]; | ||
$global-typography-caption: [object Object]; | ||
$global-typography-h1-font-family: Mulish; | ||
$global-typography-h1-font-weight: 700; | ||
$global-typography-h1-line-height: 40; | ||
$global-typography-h1-font-size: 40; | ||
$global-typography-h1-letter-spacing: 0; | ||
$global-typography-h1-paragraph-spacing: 0; | ||
$global-typography-h1-text-decoration: none; | ||
$global-typography-h1-text-case: none; | ||
$global-typography-h2-font-family: Mulish; | ||
$global-typography-h2-font-weight: 700; | ||
$global-typography-h2-line-height: 40; | ||
$global-typography-h2-font-size: 32; | ||
$global-typography-h2-letter-spacing: 0; | ||
$global-typography-h2-paragraph-spacing: 0; | ||
$global-typography-h2-text-decoration: none; | ||
$global-typography-h2-text-case: none; | ||
$global-typography-h3-font-family: Mulish; | ||
$global-typography-h3-font-weight: 700; | ||
$global-typography-h3-line-height: 32; | ||
$global-typography-h3-font-size: 24; | ||
$global-typography-h3-letter-spacing: 0; | ||
$global-typography-h3-paragraph-spacing: 0; | ||
$global-typography-h3-text-decoration: none; | ||
$global-typography-h3-text-case: none; | ||
$global-typography-h4-font-family: Mulish; | ||
$global-typography-h4-font-weight: 700; | ||
$global-typography-h4-line-height: 24; | ||
$global-typography-h4-font-size: 20; | ||
$global-typography-h4-letter-spacing: 0; | ||
$global-typography-h4-paragraph-spacing: 0; | ||
$global-typography-h4-text-decoration: none; | ||
$global-typography-h4-text-case: none; | ||
$global-typography-h5-font-family: Mulish; | ||
$global-typography-h5-font-weight: 700; | ||
$global-typography-h5-line-height: 24; | ||
$global-typography-h5-font-size: 16; | ||
$global-typography-h5-letter-spacing: 0; | ||
$global-typography-h5-paragraph-spacing: 0; | ||
$global-typography-h5-text-decoration: none; | ||
$global-typography-h5-text-case: none; | ||
$global-typography-body-font-family: Mulish; | ||
$global-typography-body-font-weight: 500; | ||
$global-typography-body-line-height: 24; | ||
$global-typography-body-font-size: 16; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For these ones it's stripping out the pixel units, is this known, and being addressed later? Or just something we can tweak with the config There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah! We haven't included it as part of the values from the get-go. We can add it to the values directly, or we can leverage this custom transformer to add the units as a suffix. My plan was to add the custom transformer to keep the values as a numerical value only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok sounds good then! |
||
$global-typography-body-letter-spacing: 0; | ||
$global-typography-body-paragraph-spacing: 0; | ||
$global-typography-body-text-decoration: none; | ||
$global-typography-body-text-case: none; | ||
$global-typography-footnote-font-family: Mulish; | ||
$global-typography-footnote-font-weight: 500; | ||
$global-typography-footnote-line-height: 16; | ||
$global-typography-footnote-font-size: 12; | ||
$global-typography-footnote-letter-spacing: 0; | ||
$global-typography-footnote-paragraph-spacing: 0; | ||
$global-typography-footnote-text-decoration: none; | ||
$global-typography-footnote-text-case: none; | ||
$global-typography-caption-font-family: Mulish; | ||
$global-typography-caption-font-weight: 500; | ||
$global-typography-caption-line-height: 16; | ||
$global-typography-caption-font-size: 14; | ||
$global-typography-caption-letter-spacing: 0; | ||
$global-typography-caption-paragraph-spacing: 0; | ||
$global-typography-caption-text-decoration: none; | ||
$global-typography-caption-text-case: none; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,69 @@ | ||
/** | ||
* Do not edit directly | ||
* Generated on Wed, 15 Jun 2022 15:44:11 GMT | ||
* Generated on Thu, 16 Jun 2022 19:25:52 GMT | ||
*/ | ||
|
||
export const GlobalTypographyH1 = {"fontFamily":"Mulish","fontWeight":"700","lineHeight":"40","fontSize":"40","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyH2 = {"fontFamily":"Mulish","fontWeight":"700","lineHeight":"40","fontSize":"32","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyH3 = {"fontFamily":"Mulish","fontWeight":"700","lineHeight":"32","fontSize":"24","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyH4 = {"fontFamily":"Mulish","fontWeight":"700","lineHeight":"24","fontSize":"20","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyH5 = {"fontFamily":"Mulish","fontWeight":"700","lineHeight":"24","fontSize":"16","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyBody = {"fontFamily":"Mulish","fontWeight":"500","lineHeight":"24","fontSize":"16","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyFootnote = {"fontFamily":"Mulish","fontWeight":"500","lineHeight":"16","fontSize":"14","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyCaption = {"fontFamily":"Mulish","fontWeight":"500","lineHeight":"16","fontSize":"12","letterSpacing":"0%","paragraphSpacing":"0","textDecoration":"none","textCase":"none"}; | ||
export const GlobalTypographyH1FontFamily = "Mulish"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new format is not an object like previously generated, but matches the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup! |
||
export const GlobalTypographyH1FontWeight = "700"; | ||
export const GlobalTypographyH1LineHeight = "40"; | ||
export const GlobalTypographyH1FontSize = "40"; | ||
export const GlobalTypographyH1LetterSpacing = "0"; | ||
export const GlobalTypographyH1ParagraphSpacing = "0"; | ||
export const GlobalTypographyH1TextDecoration = "none"; | ||
export const GlobalTypographyH1TextCase = "none"; | ||
export const GlobalTypographyH2FontFamily = "Mulish"; | ||
export const GlobalTypographyH2FontWeight = "700"; | ||
export const GlobalTypographyH2LineHeight = "40"; | ||
export const GlobalTypographyH2FontSize = "32"; | ||
export const GlobalTypographyH2LetterSpacing = "0"; | ||
export const GlobalTypographyH2ParagraphSpacing = "0"; | ||
export const GlobalTypographyH2TextDecoration = "none"; | ||
export const GlobalTypographyH2TextCase = "none"; | ||
export const GlobalTypographyH3FontFamily = "Mulish"; | ||
export const GlobalTypographyH3FontWeight = "700"; | ||
export const GlobalTypographyH3LineHeight = "32"; | ||
export const GlobalTypographyH3FontSize = "24"; | ||
export const GlobalTypographyH3LetterSpacing = "0"; | ||
export const GlobalTypographyH3ParagraphSpacing = "0"; | ||
export const GlobalTypographyH3TextDecoration = "none"; | ||
export const GlobalTypographyH3TextCase = "none"; | ||
export const GlobalTypographyH4FontFamily = "Mulish"; | ||
export const GlobalTypographyH4FontWeight = "700"; | ||
export const GlobalTypographyH4LineHeight = "24"; | ||
export const GlobalTypographyH4FontSize = "20"; | ||
export const GlobalTypographyH4LetterSpacing = "0"; | ||
export const GlobalTypographyH4ParagraphSpacing = "0"; | ||
export const GlobalTypographyH4TextDecoration = "none"; | ||
export const GlobalTypographyH4TextCase = "none"; | ||
export const GlobalTypographyH5FontFamily = "Mulish"; | ||
export const GlobalTypographyH5FontWeight = "700"; | ||
export const GlobalTypographyH5LineHeight = "24"; | ||
export const GlobalTypographyH5FontSize = "16"; | ||
export const GlobalTypographyH5LetterSpacing = "0"; | ||
export const GlobalTypographyH5ParagraphSpacing = "0"; | ||
export const GlobalTypographyH5TextDecoration = "none"; | ||
export const GlobalTypographyH5TextCase = "none"; | ||
export const GlobalTypographyBodyFontFamily = "Mulish"; | ||
export const GlobalTypographyBodyFontWeight = "500"; | ||
export const GlobalTypographyBodyLineHeight = "24"; | ||
export const GlobalTypographyBodyFontSize = "16"; | ||
export const GlobalTypographyBodyLetterSpacing = "0"; | ||
export const GlobalTypographyBodyParagraphSpacing = "0"; | ||
export const GlobalTypographyBodyTextDecoration = "none"; | ||
export const GlobalTypographyBodyTextCase = "none"; | ||
export const GlobalTypographyFootnoteFontFamily = "Mulish"; | ||
export const GlobalTypographyFootnoteFontWeight = "500"; | ||
export const GlobalTypographyFootnoteLineHeight = "16"; | ||
export const GlobalTypographyFootnoteFontSize = "12"; | ||
export const GlobalTypographyFootnoteLetterSpacing = "0"; | ||
export const GlobalTypographyFootnoteParagraphSpacing = "0"; | ||
export const GlobalTypographyFootnoteTextDecoration = "none"; | ||
export const GlobalTypographyFootnoteTextCase = "none"; | ||
export const GlobalTypographyCaptionFontFamily = "Mulish"; | ||
export const GlobalTypographyCaptionFontWeight = "500"; | ||
export const GlobalTypographyCaptionLineHeight = "16"; | ||
export const GlobalTypographyCaptionFontSize = "14"; | ||
export const GlobalTypographyCaptionLetterSpacing = "0"; | ||
export const GlobalTypographyCaptionParagraphSpacing = "0"; | ||
export const GlobalTypographyCaptionTextDecoration = "none"; | ||
export const GlobalTypographyCaptionTextCase = "none"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,3 @@ | ||
{ | ||
"source": ["data/tokens.json"], | ||
|
||
"platforms": { | ||
"Owlery": { | ||
"transformGroup": "scss", | ||
"buildPath": "build/scss/", | ||
"files": [ | ||
{ | ||
"destination": "colors.scss", | ||
"format": "scss/variables", | ||
"filter": { | ||
"type": "color" | ||
} | ||
}, | ||
|
||
{ | ||
"destination": "typography.scss", | ||
"format": "scss/variables", | ||
"filter": { | ||
"type": "typography" | ||
} | ||
} | ||
] | ||
}, | ||
|
||
"Aviary": { | ||
"transformGroup": "js", | ||
"buildPath": "build/ts/", | ||
"files": [ | ||
{ | ||
"format": "javascript/es6", | ||
"destination": "colors.ts", | ||
"filter": { | ||
"type": "color" | ||
} | ||
}, | ||
{ | ||
"format": "javascript/es6", | ||
"destination": "typography.ts", | ||
"filter": { | ||
"type": "typography" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
"source": ["data/tokens.json"] | ||
} |
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.
The new typography tokens format somehow doesn't get parsed when using the lodash filter method so I've used the
registerFilter
API here to filter for typography types.There's another way which is to check for the category instead, but that also didn't work for me when I tried it in
build.js
. Am I missing something @CCAyl?https://amzn.github.io/style-dictionary/#/formats?id=filtering-tokens
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.
yeah odd that it wasn't working for you, we can just keep this for now and play with it again after if we want!