
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@equinor/eds-tokens-build
Advanced tools
A build system for generating design tokens from the Equinor Design System (EDS) using Style Dictionary.
A build system for generating design tokens from the Equinor Design System (EDS) using Style Dictionary.
npm install @equinor/eds-tokens-build
# or
pnpm add @equinor/eds-tokens-build
# or
yarn add @equinor/eds-tokens-build
This package provides utilities for building and transforming design tokens using Style Dictionary. It includes pre-configured transforms, filters, and build configurations.
import { _extend, includeTokenFilter } from '@equinor/eds-tokens-build';
// Build basic tokens
const config = _extend({
source: ['tokens/spacing.json'],
buildPath: 'build/css/',
fileName: 'spacing',
filter: (token) => includeTokenFilter(token),
transforms: ['name/kebab', 'size/px']
});
await config.buildAllPlatforms();
Generate separate CSS files for light and dark themes using the color scheme pattern:
import {
_extend,
includeTokenFilter,
mergeLightDarkFoundation
} from '@equinor/eds-tokens-build';
// Build light color scheme CSS variables
const lightColorScheme = _extend({
source: ['tokens/light-color-scheme.json'],
include: ['tokens/light-colors.json'], // Core light colors
filter: (token) => includeTokenFilter(token, ['Color scheme']),
buildPath: 'build/css/',
fileName: 'light-color-scheme',
selector: '[data-color-scheme="light"]',
prefix: 'eds-color',
outputReferences: false,
});
// Build dark color scheme CSS variables
const darkColorScheme = _extend({
source: ['tokens/dark-color-scheme.json'],
include: ['tokens/dark-colors.json'], // Core dark colors
filter: (token) => includeTokenFilter(token, ['Color scheme']),
buildPath: 'build/css/',
fileName: 'dark-color-scheme',
selector: '[data-color-scheme="dark"]',
prefix: 'eds-color',
outputReferences: false,
});
await lightColorScheme.buildAllPlatforms();
await darkColorScheme.buildAllPlatforms();
// Merge into a single file using light-dark() CSS function
mergeLightDarkFoundation({
prefix: 'eds-color',
});
This approach:
source
for the color scheme tokens (semantic colors like primary, secondary)include
for the base color definitions (hex values, etc.)['Color scheme']
tokens to avoid outputting all colorslight-dark()
functionimport {
_extend,
includeTokenFilter,
PX_TO_REM_NAME,
FONT_QUOTE_NAME
} from '@equinor/eds-tokens-build';
const typographyConfig = _extend({
source: ['tokens/typography.json'],
buildPath: 'build/css/',
fileName: 'typography',
selector: '[data-font-size="md"]',
filter: (token) => includeTokenFilter(token, ['Font size']),
transforms: ['name/kebab', PX_TO_REM_NAME, FONT_QUOTE_NAME],
outputReferences: true
});
await typographyConfig.buildAllPlatforms();
import {
_extend,
includeTokenFilter,
PX_TRANSFORM_NAME,
PX_FORMATTED_NAME
} from '@equinor/eds-tokens-build';
const spacingConfig = _extend({
source: ['tokens/spacing.json'],
buildPath: 'build/css/',
fileName: 'spacing',
filter: (token) => includeTokenFilter(token),
transforms: ['name/kebab', PX_TO_REM_NAME, PX_FORMATTED_NAME, PX_TRANSFORM_NAME]
});
await spacingConfig.buildAllPlatforms();
The package provides several pre-configured transform constants:
PX_TO_REM_NAME
- Convert px values to remPX_FORMATTED_NAME
- Format px valuesPX_TRANSFORM_NAME
- Transform px valuesFONT_QUOTE_NAME
- Add quotes around font family names_extend(config)
Creates a Style Dictionary configuration with EDS-specific defaults.
Parameters:
source: string[]
- Source token filesbuildPath: string
- Output directoryfileName: string
- Output filenamefilter?: Function
- Token filter functiontransforms?: string[]
- Transform names to applyselector?: string
- CSS selector for outputinclude?: string[]
- Additional files to includeoutputReferences?: boolean
- Whether to output token referencesincludeTokenFilter(token, categories?)
Filters tokens based on categories or general inclusion criteria.
Parameters:
token: object
- Token object to filtercategories?: string[]
- Optional categories to filter bycreateLightDarkTransform(options)
Creates a transform for handling light/dark mode color tokens.
Parameters:
name: string
- Transform namedarkTokensObject: object
- Dark mode token valuespnpm install
pnpm dev
- Start development serverpnpm build
- Build the package for productionpnpm type-check
- Run TypeScript type checkingpnpm build
This will generate the distribution files in the dist
directory.
MIT © Equinor
FAQs
A build system for generating design tokens from the Equinor Design System (EDS) using Style Dictionary.
We found that @equinor/eds-tokens-build 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.