
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@digdir/designsystemet
Advanced tools
CLI and tooling for Designsystemet
Use --help
for available commands and options
Read the Designsystemet README to get started.
Use npx @digdir/designsystemet tokens create <options>
to create design tokens for use with Designsystemet.
This allows you to define themes including custom colors, font-family, and border-radius. We recommend using the Designsystemet theme builder for generating a valid command with correct options.
Whenever a new version of the CLI is released, or you have done changes, we recommend to update design tokens with the --clean
option to potentially remove any changes deprecated files or unneeded files.
To update design tokens, re-run npx @digdir/designsystemet tokens create <options> --clean
.
If a config file you can also re-run with "clean": true
.
⚠️ WARNING ⚠️
The design tokens created by this tool are considered an implementation detail, and is subject to change at any time without being considered a breaking change. We only support customisations done through the CLI options. Direct editing of the design tokens are not supported.Since tokens may be added or removed at any time, it is necessary to routinely re-run this command when upgrading the libraries. This will remove any direct edits to the design tokens.
Use npx @digdir/designsystemet tokens build <options>
to build CSS from design tokens generated in the previous step.
⚠️ WARNING ⚠️
The CSS files from created by this tool are considered build artifacts. They should not be edited directly. While the CSS will not change unexpectedly, new variables may be added at any time. Therefore, it is necessary to routinely re-run this command when upgrading the libraries. This will remove any direct edits to the CSS.
Whenever a new version of the CLI is released, or you have done changes, we recommend to build a new set of CSS from design tokens with the --clean
option to potentially remove any changes deprecated files or unneeded files.
⚠️ WARNING ⚠️
This feature is experimental. The config schema may change at any time.
The tokens create
command supports a config file. It will auto-detect a designsystemet.config.json
file in the current directory. You can also use the --config <path>
option to supply a different config name and location.
The main advantage of using a config file is for automation in scenarios with multiple themes.
To get started, use this template for a designsystemet.config.json
file:
{
"$schema": "node_modules/@digdir/designsystemet/dist/config.schema.json",
}
In editors which support JSON Schema, the $schema
will then give you editor hints for the structure of the file.
As a minimal example, the following CLI snippet from the theme builder
npx @digdir/designsystemet tokens create \
--main-colors "primary:#0062BA" "accent:#1E98F5" \
--neutral-color "#1E2B3C" \
--support-colors "extra1:#F45F63" "extra2:#E5AA20" \
--border-radius 4 \
--theme "theme"
...is equivalent to this designsystemet.config.json
file
{
"$schema": "./node_modules/@digdir/designsystemet/dist/config.schema.json",
"outDir": "../path/to/design-tokens",
"themes": {
"theme": {
"colors": {
"main": { "primary": "#0062BA", "accent": "#1E98F5" },
"neutral": "#1E2B3C",
"support": { "extra1": "#F45F63", "extra2": "#E5AA20" }
},
"borderRadius": 4
}
}
}
To generate new design tokens and CSS files, you would then run.
npx @digdir/designsystemet tokens create
npx @digdir/designsystemet tokens build
Have a look at the *.config.json
files under the packages/cli
in the Github repo for more complex examples.
FAQs
CLI for Designsystemet
We found that @digdir/designsystemet demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.