
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Nest CSS rules inside custom properties
Anesthetic is a small tool that does one thing - allows CSS authors to nest CSS rules inside other CSS rules in a way that meets the following criteria:
The technique is to put the declaration list for the rule you would like to nest as the value of a custom property, and to name the custom property in a special way. Here's how we'll think about the naming of these properties
"--" <custom-name> <selector> ":" <block> [ ";" ]
--
<custom-name>
is part of a valid CSS property name you choose to namespace your nested rules and keep them easily identifiable amongst all your custom propertiesselector
is a CSS selector list, with any special characters escaped by a backslash \
<block>
is a {
-block containing the declaration list of the nested rule.;
semicolon is the delimiter that is required to separate multiple properties in a declaration listHere's an example using -
as the custom name:
/* nested */
a {
color: red;
---\ b: {
color: blue;
};
}
/* expanded */
a {
color: red;
}
a b {
color: blue;
}
Here in this example, the first part of the custom property ---\ b
made up of the first two dashes plus our custom name (-
) is replaced by the selector of the original rule, so ---\ b
becomes a b
.
If you work with a different custom name, like nest-
, you can process the same rules written like this:
a {
color: red;
--nest-\ b: {
color: blue;
};
}
This package is available on npm and is delivered in two formats:
Below are some of the ways you can consume and use this package.
$ npx anesthetic 'a { color: red; ---\ b: { color: blue; }; }'
$ npx anesthetic path/to/stylesheet.css
import anesthetic from 'https://unpkg.com/anesthetic'
console.log(
anesthetic(`
a {
color: red;
---\\ b: {
color: blue;
};
}
`)
)
const anesthetic = require('anesthetic/index.cjs.js')
console.log(
anesthetic(`
a {
color: red;
---\\ b: {
color: blue;
};
}
`)
)
To expand a string, supply a string to the CLI script as the first argument
$ node cli/node.js 'a { color: red; ---\ b: { color: blue; }; }'
$ deno cli/deno.js 'a { color: red; ---\ b: { color: blue; }; }'
To expand a stylesheet, supply a pathname to the CLI script as the first argument:
$ node cli/node.js path/to/stylesheet.css
$ deno --allow-read cli/deno.js path/to/stylesheet.css
You can run
npm link
if you want to usecli/node.js
on your system as the commandanesthetic
anesthetic(string, propertyName)
string
is a string containing a CSS stylesheet to expandpropertyName
is a part of a custom property name to namespace your nested rules. The default value if omitted is -
./* nested */
a {
color: red;
---\ b: {
color: green;
---\ c: {
color: blue;
};
};
}
/* expanded */
a {
color: red;
}
a b {
color: green;
}
a b c {
color: blue;
}
/* nested */
a, b, c {
---\ d\,\ e\,\ f: {
color: lime;
};
}
/* expanded */
a d,
a e,
a f,
b d,
b e,
b f,
c d,
c e,
c f {
color: lime;
}
To see more demos, check out the tests in examples/
FAQs
Nest CSS rules inside custom properties
The npm package anesthetic receives a total of 0 weekly downloads. As such, anesthetic popularity was classified as not popular.
We found that anesthetic 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.