Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
require() LESS variables into your JS using Browserify
If you have a variables.less
file:
@foo: #fff;
@bar: 1 + 1;
@baz: @bar + @bar;
and a main.js
:
var varless = require('varless');
var foo = varless.get('foo');
var bar = varless.get('bar');
var baz = varless.get('baz');
console.log(foo, bar, baz);
then after browserify
ing:
$ browserify main.js -t [ varlessify --file ./variables.less ] > bundle.js
you get...
var varless = require('varless');
var foo = "#ffffff";
var bar = "2";
var baz = "4";
console.log(foo, bar, baz);
varless.get([lessFile], variable)
You can specify the less file either in your JS or as a build option. If both are specified, the script takes precedence.
On the command line:
$ browserify main.js -t varlessify > bundle.js
Or, with options:
$ browserify main.js -t [ varlessify --file ./variables.less ] > bundle.js
With the Browserify API:
browserify()
.add('main.js')
.transform('varlessify', { file: './variables.less' })
.bundle();
A file to parse for variable declarations by default.
An array of paths to search for during LESS parsing of @import declarations.
Just plain ol' npm installation:
npm install varlessify
MIT
FAQs
Browserify transform to require LESS variable values into your JS
The npm package varlessify receives a total of 0 weekly downloads. As such, varlessify popularity was classified as not popular.
We found that varlessify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.