Skip to content

Commit

Permalink
added font-weight transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
mimarz committed Jun 6, 2024
1 parent 94e17c7 commit 948ec72
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/cli/src/tokens/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ StyleDictionary.registerTransformGroup({
name: 'fds/css',
transforms: [
`ts/resolveMath`,
'ts/typography/fontWeight',
nameKebab.name,
sizeRem.name,
typographyShorthand.name,
Expand Down Expand Up @@ -64,6 +65,7 @@ const getCSSConfig: GetConfig = ({
folderName,
}) => {
return {
log: { verbosity: 'verbose' },
preprocessors: ['tokens-studio'],
platforms: {
css: {
Expand Down Expand Up @@ -135,7 +137,7 @@ const getStorefrontConfig = ({ fileName = 'unknown', buildPath = 'unknown' }): C
};
};

const getTypographyConfig: GetConfig = ({ buildPath = 'unknown' }) => {
const getTypographyConfig: GetConfig = ({ buildPath = 'unknown', fileName }) => {

Check failure on line 140 in packages/cli/src/tokens/build.ts

View workflow job for this annotation

GitHub Actions / Builds, lints and tests code

'fileName' is defined but never used
return {
log: { verbosity: 'verbose' },
preprocessors: ['tokens-studio'],
Expand All @@ -144,10 +146,10 @@ const getTypographyConfig: GetConfig = ({ buildPath = 'unknown' }) => {
prefix,
buildPath,
basePxFontSize,
transforms: [nameKebab.name, 'ts/size/lineheight', 'ts/size/px'],
transforms: [nameKebab.name, 'ts/size/lineheight', 'ts/size/px', 'ts/typography/fontWeight'],
files: [
{
destination: 'typography.css',
destination: `typography.css`,
format: typographyClasses.name,
filter: (token) => token.type === 'typography',
},
Expand Down Expand Up @@ -197,7 +199,7 @@ const getConfigs = (getConfig: GetConfig, outPath: string, tokensDir: string, th

// console.log(config);

return [`${folderName}: ${fileName}`, config];
return [name, config];
})
.sort();

Expand All @@ -218,7 +220,7 @@ export async function run(options: Options): Promise<void> {
getTypographyConfig,
tokensOutDir,
tokensDir,
R.pickBy((val: string[], key) => R.startsWith('light', R.toLower(key)), themes),
R.pickBy((_, key) => R.startsWith('light', R.toLower(key)), themes),
);

if (typographyConfigs.length > 0) {
Expand Down

0 comments on commit 948ec72

Please sign in to comment.