@emotion/stylis

中文文档
0.8.5发布于 2019/12/23MITTypeScriptESM + CJS零依赖近 30 天下载 2056.5万

A custom build of Stylis

原始使用文档

@emotion/stylis

A custom build of Stylis

@emotion/stylis is a version of Stylis that has been modified slightly to make it smaller. The only Stylis option that can be changed is prefix, the rest of the options are already set to the values shown below and cannot be changed. This package also only exports the constructer, so you have to do new Stylis() and use the result from that rather than directly calling Stylis. The result of that function also cannot be used to create a stylis instance unlike stylis.

type Options = {
  global: false,
  preserve: false,
  keyframe: false,
  semicolon: true,
  cascade: true,
  compress: false,
  prefix: boolean | ((key: string, value: string, context: number) => boolean)
}
import Stylis from '@emotion/stylis'

const stylis = new Stylis()

stylis('.css-hash', 'display:flex;') // .css-hash{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}

Building this package

To build this package from a newer version of stylis, update the version of stylis that is installed as a devDependency and run node build.js in the directory of this package. This will read the source of stylis, transform it slightly, use the Google Closure Compiler REST API to minify it, format it with Prettier and then write it to src/stylis.min.js.

Thanks

Stylis was written by Sultan Tarimo. ❤️

版本与发布记录

@emotion/stylis 共发布 22 个版本,首次发布于 2018/04/14;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.8.5latest2019/12/236 年前
0.8.42019/06/267 年前
0.8.32018/11/207 年前
0.8.22018/11/128 年前
0.8.12018/11/128 年前
0.8.02018/10/138 年前

其他发布通道:really-unsafe-please-do-not-use → 10.0.0-really-unsafe-please-do-not-use.2。

关于 @emotion/stylis 的常见问题

@emotion/stylis 是什么?

A custom build of Stylis

如何安装 @emotion/stylis?

在项目目录运行 npm install @emotion/stylis,或使用 pnpm add / yarn add / bun add。

@emotion/stylis 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@emotion/stylis 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@emotion/stylis 可以商用吗?

@emotion/stylis 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@emotion/stylis 的下载量有多少?

根据 npm 官方下载统计,@emotion/stylis 在 2026/10/14 – 2026/11/12 这 30 天内被下载 20,564,864 次,日均约 685,495 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@emotion/stylis 还在维护吗?

最新版本 0.8.5 发布于 2019/12/23(6 年前);至今共发布 22 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/04/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。