
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
Generating CSS patches (just like a diff).
The easiest way to make a new theme is just copy the file and change some stuff or if you use preprocessor (such as SCSS, Less, etc.) you can just change some variables and get a new style.
But serving files with big amount of literally the same code is not a good idea, so this is when css-patch can help you.
You can pass 2 stylesheets (original/base and expected) to generateCSSPatch
and get a new stylesheet. This new stylesheet is intended to be applied after
original one and will have the same effect as if you applied expected one.
In other words, the new stylesheet will consist of the resulting "overloads" for
the original one.
Imagine if you have two versions of the same CSS.
You can use this module to get the "difference" between them.
Install via yarn:
yarn add css-patch
Install via npm:
npm i css-patch
Read the docs on GitHub pages.
For advanced usage see the docs for transformCSS function and CSSTransformerBase class.
unsetIf something existed in original stylesheet missing in expected one,
will result of being transformed to <something>: unset;.
Logically the same but with a different order combined rules (e.g. .a,.b and .b,.a)
will be considered as a different rules.
If rules have exact the same name their declarations would be merged (later appeared declarations will be a higher priority).
For example .a{a:1;c:3;}.a{a:2;b:2;} will be threat as .a{a:2;b:2;c;3}.
Declarations are sorted alphabetically.
const { generateCSSPatch, } = require('css-patch');
import { generateCSSPatch, } from 'css-patch';
console.log(
generateCSSPatch(
'a{a:1;b:1;}b{b:1;}c{a:1;}d{a:1;}',
'a{a:1;}b{b:2;}c{a:1;}'
)
); // 'a{b:unset;}b{b:2;}d{a:unset;}'
FAQs
CSS patch generator.
The npm package css-patch receives a total of 2 weekly downloads. As such, css-patch popularity was classified as not popular.
We found that css-patch 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.