Skip to content

fix(cli): support secondary fontFamily in schema and in tokens#4394

Closed
Promises wants to merge 1 commit intodigdir:mainfrom
Promises:main
Closed

fix(cli): support secondary fontFamily in schema and in tokens#4394
Promises wants to merge 1 commit intodigdir:mainfrom
Promises:main

Conversation

@Promises
Copy link
Copy Markdown

Summary

This PR adds support for configuring a secondary font family in the CLI. Users can now specify a different font family for secondary typography using the --secondary-font-family option when generating tokens. If not specified, it falls back to the primary font family. This enables more flexible typography configuration for themes that require different font families for primary and secondary text.

Checks

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 12, 2026

🦋 Changeset detected

Latest commit: d1b444c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@digdir/designsystemet Patch
@digdir/designsystemet-react Patch
@digdir/designsystemet-theme Patch
@digdir/designsystemet-css Patch
@digdir/designsystemet-types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mimarz
Copy link
Copy Markdown
Collaborator

mimarz commented Jan 12, 2026

Hey!

Thanks for the contribution, we are actually currently in the process of reworking/improving the typography token structure. We have planned some changes to the config in this regard also.

I'll have to check how whats the plane atm, is this something you need currently for you project?

@Promises
Copy link
Copy Markdown
Author

Hey!

Thanks for the contribution, we are actually currently in the process of reworking/improving the typography token structure. We have planned some changes to the config in this regard also.

I'll have to check how whats the plane atm, is this something you need currently for you project?

Yes I a updated a 1.0.0 project, which uses a different font for titles, I look forward to your planned changes. But this one is very much needed soon.

@mimarz
Copy link
Copy Markdown
Collaborator

mimarz commented Jan 12, 2026

Hey!
Thanks for the contribution, we are actually currently in the process of reworking/improving the typography token structure. We have planned some changes to the config in this regard also.
I'll have to check how whats the plane atm, is this something you need currently for you project?

Yes I a updated a 1.0.0 project, which uses a different font for titles, I look forward to your planned changes. But this one is very much needed soon.

Are you using the cli or config file for creating tokens?

@Promises
Copy link
Copy Markdown
Author

Promises commented Jan 12, 2026

Hey!
Thanks for the contribution, we are actually currently in the process of reworking/improving the typography token structure. We have planned some changes to the config in this regard also.
I'll have to check how whats the plane atm, is this something you need currently for you project?

Yes I a updated a 1.0.0 project, which uses a different font for titles, I look forward to your planned changes. But this one is very much needed soon.

Are you using the cli or config file for creating tokens?

Just migrated to the config file

"theme" repo https://github.com/PorticoEstate/digdir-design-tokens

frontend (aktiv-kommune): https://github.com/PorticoEstate/PorticoEstate-v2/tree/master/src/modules/bookingfrontend/client

@mimarz
Copy link
Copy Markdown
Collaborator

mimarz commented Jan 13, 2026

Hey!
Thanks for the contribution, we are actually currently in the process of reworking/improving the typography token structure. We have planned some changes to the config in this regard also.
I'll have to check how whats the plane atm, is this something you need currently for you project?

Yes I a updated a 1.0.0 project, which uses a different font for titles, I look forward to your planned changes. But this one is very much needed soon.

Are you using the cli or config file for creating tokens?

Just migrated to the config file

"theme" repo https://github.com/PorticoEstate/digdir-design-tokens

frontend (aktiv-kommune): https://github.com/PorticoEstate/PorticoEstate-v2/tree/master/src/modules/bookingfrontend/client

Good morning! We had a small talk about how users should configure typography, and this might change in the future to be more flexible and scalable. Not sure if we want to add this feature just to be removed in the future, let use examine this possibility closer :)

Nice work on aktive-kommune btw! 👏

@mimarz
Copy link
Copy Markdown
Collaborator

mimarz commented Jan 14, 2026

Hi! We are a bit hesitant to add this now as it would already effectively deprecated.

We are planning to change how typography is structured in tokens and also defined in the config.

A team member suggested you can try using yq in your post create tokens script to edit the secondary typography token. yq is preinstalled in Github Actions runners.

yq

yq --inplace '."portal"."font-family"."$value" |= "Poppins"' ./primitives/modes/typography/secondary/portal.json

We have also updated out design-tokens template with a new workflow, you use this as inspiration. https://github.com/designsystemet/design-tokens/blob/main/.github/workflows/generate-tokens.yml

@unekinn
Copy link
Copy Markdown
Contributor

unekinn commented Jan 14, 2026

yq --inplace '."portal"."font-family"."$value" |= "Poppins"' ./primitives/modes/typography/secondary/portal.json

To be more clear, I suggest adding something like this to your package.json:

"scripts": {
  "postprocess-tokens": "yq --inplace '.portal.\"font-family\".\"$value\" |= \"Poppins\"' ./primitives/modes/typography/secondary/portal.json"
  "create": "designsystemet tokens create && npm run postprocess-tokens"
  // ...your other scripts...
}

Then you run npm run create instead of npx @digdir/designsystemet tokens create when you need to regenerate tokens.

@mimarz
Copy link
Copy Markdown
Collaborator

mimarz commented Jan 29, 2026

Closing this now due to now activity. Please contact us again if there is anything else :)

@mimarz mimarz closed this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants