零运行时样式表
{\fn方正粗倩简体\fs12\an8\1cHFFFF00\b0}香草取出
**零运行时的样式表 -- -- TypeScript。 **
用 TypeScript(或称 JavaScript) 写出您的风格,使用本地范围类名和 CSS 变量,然后在构建时生成静态 CSS 文件.
基本上,它是[ " CSS 模块 " (https://github.com/css-modules/css-modules)- in-TypeScript " ,但范围是CSS变量+堆积。
所有在构建时生成的样式——就像 [Sass] (https://sass-lang.com), [Less] (http://lesscss.org)等.
& nbsp; 相对于标准 CSS 的最小抽象化 。
工作带有任何前端框架—— 甚至没有框架 。
本地范围类名—— 就像 [CSS 模块.] (https://github.com/css-modules/css-modules)
& nbsp; 局部范围 [CSS变量] (https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), 键框' 和 “% font-face” 规则 .
& nbsp; 高级主题系统, 支持同步主题 。 没有全球人!
Utils 用于生成基于变量的 “ calc” 表达式。
类型安全样式通过 [CSSType.] (ZZURL5Z)
可选运行时间版本用于开发和测试.
动态运行时间主题的可选 API 。
-- -- . . .
[检查设置指南、示例和API文件的文档站点。 ] (https://vanilla-extract.style)
-- -- . . .
[在 CodeSandbox 中为自己尝试。 ] (https://codesandbox.io/s/github/vanilla-extract-css/vanilla-extract/tree/master/examples/webpack-react?file=/src/App.css.ts)
-- -- . . .
** 在`.cs.ts'文件中写出你的风格。 **
(原始内容存档于2019-09-29) (英语). ```ts // styles.css.ts
import { createTheme, style } from '@vanilla-extract/css';
export const [themeClass, vars] = createTheme({ color: { brand: 'blue' }, font: { body: 'arial' } });
export const exampleStyle = style({ backgroundColor: vars.color.brand, fontFamily: vars.font.body, color: 'white', padding: 10 });
> 一旦你[配置了你的构建工具,](https://vanilla-extract.style/documentation/getting-started/)这些`.cs.ts'文件将在构建时进行评估。 这些文件中的代码都不会包含在您的最终捆绑中. 把它当作是用TypeScript作为你的预处理器,而不是用Sass,Less等.
{\fn华文楷体\fs16\1cHE0E0E0}然后运送 `vanilla.js` 文件的库在应用程序使用 vanilla-extract 插件时也会导致构建失败。
Turbopack: 显示 `unstable_splitCssPerRule` 或在开发中默认关闭 (每个 CSS 规则一个模块会使 `下一个开发` 受内存限制)
在加载包含带有文件扩展名 `.css.ts` 的样式文件的外部库时,vite-plugin-vanilla-extract 中出现了"无效导出"错误
特性:允许自定义模块文件过滤器(支持纯 `css.ts` 约定)
支持不包含 `name` 字段的 `deno.json` 和 `package.json`
Vite 插件的插件钩子过滤器
构建时出现重复的哈希值
无法从使用 rollup-plugin 构建的库中消费导出的主题变量
支持 @page (一般的打印媒体样式)
香草提取物 + Bun 运行时不兼容