Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solidpixels/less-plugin-json

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solidpixels/less-plugin-json

Allow LESS to import JSON files

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

JSON less.js file manager

Usage

In LESS file, you can import JSON file as variables file. Regular JSON property will be flattened with -- separator. To produce LESS maps or lists, prefix variable with dollar.

{
  "border": {
    "size": "10px",
    "color": "red"
  },
  "$features": ["a", "b"],
  "$colors": {
    "red": "#ff0000",
    "green": "#00ff00"
  }
}
@import './variables.json';

body {
  border: @border--size @border--color;
  features: @features;
  color: @colors[red];
}

Will compile to:

body {
  border: 10px red;
  features: a, b;
  colors red;
}

Use

lessc style.less --plugin=index.js

Inspired by https://github.com/fortes/less-plugin-load-json#readme.

Keywords

FAQs

Package last updated on 05 Feb 2024

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