๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
DemoInstallSign in
Socket

@vanilla-extract/vite-plugin

Package Overview
Dependencies
Maintainers
4
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vanilla-extract/vite-plugin

Zero-runtime Stylesheets-in-TypeScript

5.0.3
latest
Source
npm
Version published
Weekly downloads
181K
3.8%
Maintainers
4
Weekly downloads
ย 
Created

What is @vanilla-extract/vite-plugin?

@vanilla-extract/vite-plugin is a Vite plugin that integrates with the vanilla-extract CSS-in-JS library. It allows developers to use vanilla-extract's zero-runtime CSS framework within Vite projects, enabling the creation of type-safe, themeable, and performant styles.

What are @vanilla-extract/vite-plugin's main functionalities?

Integration with Vite

This feature allows you to integrate vanilla-extract with a Vite project. By adding the plugin to the Vite configuration, you can use vanilla-extract's CSS-in-JS capabilities seamlessly within your Vite application.

import { defineConfig } from 'vite';
import vanillaExtractPlugin from '@vanilla-extract/vite-plugin';

export default defineConfig({
  plugins: [vanillaExtractPlugin()]
});

Type-safe CSS

This feature allows you to define styles using TypeScript, ensuring type safety and autocompletion. The styles are compiled to static CSS at build time, providing a zero-runtime solution.

import { style } from '@vanilla-extract/css';

export const button = style({
  backgroundColor: 'blue',
  color: 'white',
  padding: '10px 20px',
  borderRadius: '5px'
});

Theming support

This feature allows you to create themes and use them in your styles. The createTheme function generates CSS variables that can be used throughout your styles, making it easy to switch themes dynamically.

import { createTheme, style } from '@vanilla-extract/css';

export const [themeClass, vars] = createTheme({
  color: {
    primary: 'blue',
    secondary: 'green'
  }
});

export const button = style({
  backgroundColor: vars.color.primary,
  color: 'white'
});

Other packages similar to @vanilla-extract/vite-plugin

FAQs

Package last updated on 26 May 2025

Did you know?

Socket

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.

Install

Related posts