
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@ant-design/cssinjs
Advanced tools
Component level cssinjs solution used in ant.design. It's a subset of Emotion with design token logic wrapper. Please feel free to use emotion directly if you want to find a web cssinjs solution. cssinjs related dep packages:
https://ant-design.github.io/cssinjs/
npm install @ant-design/cssinjs
or
yarn add @ant-design/cssinjs
pnpm add @ant-design/cssinjs
npm install
npm start
@ant-design/cssinjs is released under the MIT license.
| Prop | Desc | Type | Default |
|---|---|---|---|
| autoClear | Clear inject style element when component remove. | boolean | false |
| cache | Config cssinjs cache entity. Only set when you need ssr to extract style on you own. | CacheEntity | - |
| hashPriority | Use :where selector to reduce hashId css selector priority | 'low' | 'high' | 'low' |
| container | Tell cssinjs where to inject style in. | Element | ShadowRoot | document.head |
| ssrInline | Component wil render inline <style /> for fallback in SSR. Not recommend. | boolean | false |
| transformers | Transform css before inject in document. Please note that transformers do not support dynamic update | Transformer[] | - |
return CacheEntity for StyleProvider.
Create theme object. When same algorithm provided, it will return same object.
Since @ant-design/cssinjs use strong constraints for cache hit performance, we recommend to view demo basic.tsx for usage and animation.tsx for animation usage.
Extracts the styles from the cache and returns them as a string.
cache (Cache): The cache instance containing the styles.options (object | boolean, optional): Options for extracting the styles.
plain (boolean, optional): If true, the styles will be returned in plain format. Default is false.types (string | string[], optional): The types of styles to extract. Default is ['style', 'token', 'cssVar'].import { extractStyle, createCache } from '@ant-design/cssinjs';
// 创建并填充缓存
const cache = createCache();
// 注意:在实际使用中,缓存通常会在渲染组件时自动填充
// 提取样式
const styles = extractStyle(cache, { plain: true, types: ['style', 'token'] });
// 使用提取的样式
const styleElement = document.createElement('style');
styleElement.innerHTML = styles;
document.head.appendChild(styleElement);
When you need transform CSSObject before inject style. You can use transformers to handle this:
import {
legacyLogicalPropertiesTransformer,
StyleProvider,
} from '@ant-design/cssinjs';
export default () => (
<StyleProvider transformers={[legacyLogicalPropertiesTransformer]}>
<MyApp />
</StyleProvider>
);
Follow are the transform we provide:
Convert logical properties to legacy properties. e.g. marginBlockStart to marginTop:
Convert pixel units to rem units. px2remTransformer.options
styled-components is a popular library for writing CSS-in-JS. It allows you to create styled components with tagged template literals. Compared to @ant-design/cssinjs, styled-components is more general-purpose and not specifically tied to Ant Design.
Emotion is another library for writing CSS-in-JS. It offers both a styled API similar to styled-components and a css function for creating class names. Emotion is known for its performance and flexibility, making it a strong alternative to @ant-design/cssinjs.
JSS is a library for writing CSS-in-JS with a focus on high performance and modularity. It provides a powerful API for defining styles and theming. JSS is more low-level compared to @ant-design/cssinjs, offering more control but requiring more setup.
FAQs
Component level cssinjs resolution for antd
The npm package @ant-design/cssinjs receives a total of 824,638 weekly downloads. As such, @ant-design/cssinjs popularity was classified as popular.
We found that @ant-design/cssinjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.