🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

less-vars2js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

less-vars2js

LESS variables to a javascript object

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

less-vars2js

Read LESS variables from any file and return a JSON string for modifyVars.

With webpack

Example:

/package.json

{
  "name": "test-it",
  "theme": {
    "@primary-color": "#1DA57A",
    "@link-color": "#1DA57A",
    "@border-radius-base": "2px",
    "@font-size-base": "16px",
    "@line-height-base": "1.2",
    "@font-family":"monospace,-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Helvetica, \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\", SimSun, sans-serif"
  }
}

/webpack.config.js

...
const vars2js = require('less-vars2js');
const theme = path.resolve(__dirname, './package.json');

module.exports = {
  ...
  module: {
    loaders: [
      ...
      {
        test: /\.module\.less$/,
        loader: ExtractTextPlugin.extract(
          'css?sourceMap&modules&localIdentName=[local]___[hash:base64:5]!!' +
          'postcss!' +
          `less-loader?{"sourceMap":true,"modifyVars":${vars2js(theme)}}`
        ),
      }
    ]
  }
}


FAQs

Package last updated on 27 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