https://github.com/paulmorar/cast-less-vars-to-json
A tool that allows you to cast less variables into JSON key-value pairs.
https://github.com/paulmorar/cast-less-vars-to-json
json less less-variables less-vars
Last synced: 4 months ago
JSON representation
A tool that allows you to cast less variables into JSON key-value pairs.
- Host: GitHub
- URL: https://github.com/paulmorar/cast-less-vars-to-json
- Owner: paulmorar
- License: mit
- Created: 2020-09-01T12:32:06.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-12T20:30:14.000Z (6 months ago)
- Last Synced: 2025-02-11T15:04:05.763Z (5 months ago)
- Topics: json, less, less-variables, less-vars
- Language: JavaScript
- Homepage:
- Size: 279 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Description
This tool allows you to cast less variables into JSON key-value pairs.
This is based on [less-variables-to-json](https://github.com/khell/less-variables-to-json), for which maintenance stopped.## Install
`npm install cast-less-vars-to-json`
or
`yarn add cast-less-vars-to-json`## Usage
Returns a `Promise`.
```js
const castLessVarsToJson = require('cast-less-vars-to-json');// Standard usage
castLessVarsToJson("@primary-color: red;").then((result) => {
const json = result; // json = { "@primary-color": "red" }
});// With a projection function to change the name
const nameProjectionFunc = (name) => name.substr(1);
castLessVarsToJson("@primary-color: red;", { nameProjectionFunc }).then((result) => {
const json = result; // json = { "primary-color": "red" }
};
```## License
MIT