Socket
Socket
Sign inDemoInstall

@jasonnutter/less-js-vars

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jasonnutter/less-js-vars

Utility to parse Less variables into JavaScript variables


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

@jasonnutter/less-js-vars

Utility to parse Less variables into JavaScript variables.

Installation

yarn add @jasonnutter/less-js-vars --save
npm install @jasonnutter/less-js-vars --save

Usage

Assumes that your code has extracted the raw text of the less file, e.g. using raw-loader or fs.readFile.

Variable names will be in camelCase.

colors.less:

@white: #fff;
@black-color: #000;

raw-loader:

import lessJsVars from '@jasonnutter/less-js-vars';
import colors from '!!raw-loader!./colors.less';

const parsedColors = lessJsVars(colors);

console.log(parsedColors.white);
console.log(parsedColors.blackColor);

fs.readFile:

import lessJsVars from '@jasonnutter/less-js-vars';
import fs from 'fs';

fs.readFile('./colors.less', 'utf8', (err, colors) => {
    const parsedColors = lessJsVars(colors);

    console.log(parsedColors.white);
    console.log(parsedColors.blackColor);
});

Prior Art

Inspired by less-vars-to-js.

Keywords

FAQs

Package last updated on 23 Apr 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc