Gathering detailed insights and metrics for @vanilla-extract/css-utils
Gathering detailed insights and metrics for @vanilla-extract/css-utils
Gathering detailed insights and metrics for @vanilla-extract/css-utils
Gathering detailed insights and metrics for @vanilla-extract/css-utils
Zero-runtime Stylesheets-in-TypeScript
npm install @vanilla-extract/css-utils
@vanilla-extract/webpack-plugin@2.3.15
Published on 24 Nov 2024
@vanilla-extract/vite-plugin@4.0.18
Published on 24 Nov 2024
@vanilla-extract/parcel-transformer@1.0.11
Published on 24 Nov 2024
@vanilla-extract/rollup-plugin@1.3.11
Published on 24 Nov 2024
@vanilla-extract/next-plugin@2.4.7
Published on 24 Nov 2024
@vanilla-extract/jest-transform@1.1.11
Published on 24 Nov 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
9,632 Stars
725 Commits
295 Forks
30 Watching
34 Branches
114 Contributors
Updated on 28 Nov 2024
Minified
Minified + Gzipped
TypeScript (85.64%)
CSS (11.73%)
JavaScript (2.28%)
HTML (0.35%)
Cumulative downloads
Total Downloads
Last day
-15.1%
25,292
Compared to previous day
Last week
5.4%
138,460
Compared to previous week
Last month
37.1%
579,420
Compared to previous month
Last year
-9.2%
5,581,624
Compared to previous year
No dependencies detected.
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-in-TypeScriptโ but with scoped CSS Variables + heaps more.
๐ฅ ย All styles generated at build time โ just like Sass, Less, etc.
โจ ย Minimal abstraction over standard CSS.
๐ฆ ย Works with any front-end framework โ or even without one.
๐ณ ย Locally scoped class names โ just like CSS Modules.
๐ ย Locally scoped CSS Variables, @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.
๐โโ๏ธ ย 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.
๐ฅ ย Try it out for yourself in CodeSandbox.
Write your styles in .css.ts
files.
1// styles.css.ts 2 3import { createTheme, style } from '@vanilla-extract/css'; 4 5export const [themeClass, vars] = createTheme({ 6 color: { 7 brand: 'blue' 8 }, 9 font: { 10 body: 'arial' 11 } 12}); 13 14export const exampleStyle = style({ 15 backgroundColor: vars.color.brand, 16 fontFamily: vars.font.body, 17 color: 'white', 18 padding: 10 19});
๐ก Once you've configured your build tooling, 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.
1// app.ts 2 3import { themeClass, exampleStyle } from './styles.css.ts'; 4 5document.write(` 6 <section class="${themeClass}"> 7 <h1 class="${exampleStyle}">Hello world!</h1> 8 </section> 9`);
Want to work at a higher level while maximising style re-use? Check out ๐จ Sprinkles, our official zero-runtime atomic CSS framework, built on top of vanilla-extract.
MIT.
No vulnerabilities found.
No security vulnerabilities found.