
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
@hon2a/less-vars-to-js
Advanced tools
Parse a less variable list and its dependencies and return a map of all resolved variables
Parse a less variable list and its dependencies and return a map of all resolved variables
Install using
npm install @hon2a/less-vars-to-js
Use to load file and all its imports, resolve all variables, and collect them. E.g. the following setup:
<CWD>/node_modules/some-lib/dist/vars.less
@primary-color: green;
@error-color: brickred;
src/style/theme.less
@import '~some-lib/dist/vars';
@primary-color: blue;
src/style/variables.less
@import './theme';
@secondary-color: darken(@primary-color, 10);
@match-rate-low-color: @error-color;
yields the following extraction:
import { loadAndResolveLessVars } from '@hon2a/less-vars-to-js'
const theme = await loadAndResolveLessVars('./src/style/variables.less')
/* {
* 'primary-color': 'blue',
* 'error-color': 'brickred',
* 'secondary-color': '#0000cc',
* 'match-rate-color': 'brickred'
* }
*/
Note: If you're using external imports (e.g. import '~someLib/path/to/styles.less';
), this
needs to run in the root folder of your package, so that it finds the libs at ./node_modules
.
Pass Less parser options as a second argument to loadAndResolveLessVars
if you need to customize them.
Install dependencies using:
npm install
After you modify sources, run the following (or set up your IDE to do it for you):
npm run format
npm run lint
npm test
and fix the errors, if there are any.
Publishing is done in two steps:
npm version <patch|minor|major>
git push --follow-tags
npm publish --access public
FAQs
Parse a less variable list and its dependencies and return a map of all resolved variables
We found that @hon2a/less-vars-to-js 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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.