We also included a set of metadata files for different themes and scopes. Currently the only supported theme is ai and supported scopes are global and palette. The dist file names are in the format of variables.<scope>.<theme>.<format>, where <scope> and <theme> are both optional. eg.
variables.global.less # global variables, w/o component variablesvariables.palette.ai.less # global color palette variables in AI theme
Custom functions
dls-contextual(@color, @type)
To generate contextual colors according to the given brand color.
Params:
@color: Color - the brand color.
@type: info | success | warning | error - the color context.
To calculate the absolute line-height from the given line-height and font-size value.
Will return @line-height directly if it is an absolute length (eg. 15px, 2em). Will return the product of @line-height and @font-size for relative lengths (eg. 1.5, 200%).
The theme of the DLS. If not specified, the default theme will be used.
reduceCalc: boolean
Indicates whether to reduce calc expression to the simplest form or not.
Default value: true.
Tooling
CLI checker
npx dls check -c -o result.log
Commands
check
To check which variables are not used inside a directory. The current strategy is plain text search so that doesn't cover the case of Less's variable name interpolation.
Options
--dir / -d
The target directory to check.
Default: ..
--exclude / -x
Comma-separated glob expression, indicates which files should be ignored.
Default: node_modules,test.
npx dls check -x node_modules,test,dist # or --exclude=node_modules,test,dist
--components / -c
Comma-separated component names to specify which component-level variables will be checked. --components=all will check all component-level variables.
Variables can be ignored if you put a .dlsignore file under the project root directory, with each variable (should be prefixed by @) on a single line. Lines led by # will be treated as comments.
npx dls check -c button,select # or --components=button,selectnpx dls check -c all # or --components=all
--output / -o
The output file for the check result.
npx dls check -o result.log # or --output=result.log