less-json-varsdeprecated

A plugin for convert less vars to json.

Usage no npm install needed!

<script type="module">
  import lessJsonVars from 'https://cdn.skypack.dev/less-json-vars';
</script>

README

less-json-vars

A plugin for convert less vars to json.

usage

const getLessVariables: (content: string, options?: Partial<Options>) => Record<string, string>;

example

const { getLessVariables } = require('less-json-vars');

const content = '@primary-color: #ffffff;\n @color: #000000';

const variables = getLessVariables(content);

console.log(variables); // { '@primary-color': '#ffffff', 'color': '#000000' }

options

strip (boolean): Whether to remove the prefix. (default false)

debug (boolean): Whether open debug mode. (default false)

format('camelCase' | 'kebabCase' | 'none'): Format key of variables. (default 'none')

transform (boolean): Should transform current variable in values. (default true)

license

MIT