Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unocss/vite

Package Overview
Dependencies
Maintainers
2
Versions
380
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unocss/vite

The Vite plugin for UnoCSS

  • 0.65.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @unocss/vite?

@unocss/vite is a utility-first CSS framework that integrates with Vite, a build tool for modern web projects. It provides a highly customizable and performant way to handle CSS in your Vite projects, leveraging the power of utility classes and on-demand generation.

What are @unocss/vite's main functionalities?

Utility-First CSS

This feature allows you to use utility-first CSS classes in your project. The code sample shows how to integrate Unocss with a Vite project.

import { defineConfig } from 'vite';
import Unocss from '@unocss/vite';

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

On-Demand Generation

Unocss generates CSS on-demand, meaning only the styles you use in your HTML or JavaScript are included in the final build. The code sample demonstrates how to configure Unocss with a preset for on-demand generation.

import { defineConfig } from 'vite';
import Unocss from '@unocss/vite';

export default defineConfig({
  plugins: [
    Unocss({
      presets: [
        require('@unocss/preset-uno'),
      ],
    }),
  ],
});

Customizable

Unocss is highly customizable, allowing you to define your own utility classes and rules. The code sample shows how to add custom rules for margin and padding.

import { defineConfig } from 'vite';
import Unocss from '@unocss/vite';

export default defineConfig({
  plugins: [
    Unocss({
      rules: [
        ['m-1', { margin: '0.25rem' }],
        ['p-1', { padding: '0.25rem' }],
      ],
    }),
  ],
});

Other packages similar to @unocss/vite

Keywords

FAQs

Package last updated on 04 Dec 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc