Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

vanilla-extract

> 编程语言
Open source

Zero-runtime Stylesheets-in-TypeScript

10.4K stars0 likes0 views
WebsiteGitHub

About

Zero-runtime Stylesheets-in-TypeScript

# vanilla-extract **Zero-runtime Stylesheets-in-TypeScript.** Write your styles in TypeScript (or JavaScript) with locally scoped class names and CSS Variables, then generate static CSS files at build time. Basically, it’s [“CSS Modules](https://github.com/css-modules/css-modules)-in-TypeScript” but with scoped CSS Variables + heaps more.   All styles generated at build time — just like [Sass](https://sass-lang.com), [Less](http://lesscss.org), etc. ✨   Minimal abstraction over standard CSS.   Works with any front-end framework — or even without one.   Locally scoped class names — just like [CSS Modules.](https://github.com/css-modules/css-modules)   Locally scoped [CSS Variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), `@keyframes` and `@font-face` rules.   High-level theme system with support for simultaneous themes. No globals!   Utils for generating variable-based `calc` expressions.   Type-safe styles via [CSSType.](https://github.com/frenic/csstype) ‍♂️   Optional runtime version for development and testing.   Optional API for dynamic runtime theming. --- [Check out the documentation site for setup guides, examples and API docs.](https://vanilla-extract.style) ---   [Try it out for yourself in CodeSandbox.](https://codesandbox.io/s/github/vanilla-extract-css/vanilla-extract/tree/master/examples/webpack-react?file=/src/App.css.ts) --- **Write your styles in `.css.ts` files.** ```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 }); ``` > Once you've [configured your build tooling,](https://vanilla-extract.style/documentation/getting-started/) these `.css.ts` files will be evaluated at build time. None of the code in these files will be included in your final bundle. Think of it as using TypeScript as your preprocessor instead of Sass, Less, etc. **Then consume them in your markup.** ```ts // app.ts import { themeClass, exampleStyle } from './styles.css.ts'; document.write(`

Hello world!

`); ``` --- Want to work at a higher level while maximising style re-use? Check out [Sprinkles](https://vanilla-extract.style/documentation/packages/sprinkles), our official zero-runtime atomic CSS framework, built on top of vanilla-extract. --- ## [Contributing] [Contributing]: ./CONTRIBUTING.md ## Thanks - [Nathan Nam Tran](https://twitter.com/naistran) for creating [css-in-js-loader](https://github.com/naistran/css-in-js-loader), which served as the initial starting point for [treat](https://seek-oss.github.io/treat), the precursor to this library. - [Stitches](https://stitches.dev/) for getting us excited about CSS-Variables-in-JS. - [SEEK](https://www.seek.com.au) for giving us the space to do interesting work. ## License MIT.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言