TS CSSVars - API ReferenceDocs


TS CSSVars - API Reference / mergeCssVars

Function: mergeCssVars()

mergeCssVars<T>(…cssVars): MergeVars<T>

Merges two or more CssVarContext object into a single context. Usefull to make the css variable definitions modular and use the all together from a single place.

Type Parameters

T extends NonEmptyArray<CssVarContext<string>>

Parameters

• …cssVars: T

the CssVarContext objects to merge

Returns

MergeVars<T>

a merged CssVarContext object

Example

export const baseCssVars = makeCssVars(`
  --primary-color: red;
  --secondary-color: blue;
`);

export const navCssVars = makeCssVars(`
  --gap: 5%;
  --nav-width: 500;
`);

export const mainCssVars = mergeCssVars(baseCssVars, navCssVars);

Defined in

lib/mergeCssVars.ts:42