Socket
Socket
Sign inDemoInstall

less-variable-resolver

Package Overview
Dependencies
28
Maintainers
11
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    less-variable-resolver

Resolve variables defined by other variables' values - to allow for conversion into languages not supporting lazy evaluation


Version published
Maintainers
11
Install size
399 kB
Created

Readme

Source

less-variable-resolver

Resolve variables defined by other variables' values - to allow for conversion into languages not supporting lazy evaluation.

This was developed to be able to use variables declared in a less file inside of SCSS after conversion (e.g. through sast). Take a look at the test cases to better understand the implications and side effects.

Usage example

const gonzales = require( 'gonzales-pe' ),
	lessVariableResolver = require( 'less-variable-resolver' ),
	sast = require( 'sast' );

// build AST from less
const lessTree = gonzales.parse(
	fs.readFileSync( '_my_variables.less', 'utf8' ),
	{ syntax: 'less' },
);

// resolve variables
lessVariableResolver.resolveVariablesInTree( lessTree );

// convert less to scss
const scssTree = sast.parse( lessTree.toString(), { syntax: 'less' } );

console.log( sast.stringify( scssTree ) ); // SCSS variables

Development

The following examples use docker and docker-compose to ease creating a level playing field for development but are not essential to this project.

Building Docker image

# ensure the node user uses your user id, so you own created files
docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) node

Installation

docker-compose run --rm node npm install

Running code quality tools

docker-compose run --rm node npm test

Keywords

FAQs

Last updated on 23 May 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc