Skip to content

A tool that allows you to cast less variables into JSON key-value pairs.

License

Notifications You must be signed in to change notification settings

paulmorar/cast-less-vars-to-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This tool allows you to cast less variables into JSON key-value pairs. This is based on 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.

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

About

A tool that allows you to cast less variables into JSON key-value pairs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published