You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vite-plugin-classname

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-classname

A quick plugin to register className prefixes, this eliminates the need for component library authors to define an additional prefix variable in both the JS and CSS sections.

0.0.3
latest
npmnpm
Version published
Weekly downloads
226
-16.91%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-classname

A quick plugin to register className prefixes, this eliminates the need for component library authors to define an additional prefix variable in both the JS and CSS sections.

It is better to prevent class name conflicts in your component library

Install

$ pnpm add vite-plugin-classname -D
// vite.config.ts
import { defineConfig } from 'vite';
import { VitePluginClassName } from 'vite-plugin-classname';

export default defineConfig({
  plugins: [
    VitePluginClassName({ prefixClassName: 'demo' })
  ]
})

Usage

It will process CSS files by default

If you use CSS preprocessors, you'll need to configure them a little extra

Set the prefix class name

VitePluginClassName({ 
  prefixClassName: 'demo', 
})

Use sass

VitePluginClassName({ 
  prefixClassName: 'demo', 
  cssSuffix: ['.sass']
})

Use scss

VitePluginClassName({ 
  prefixClassName: 'demo', 
  cssSuffix: ['.scss']
})

Use less

VitePluginClassName({ 
  prefixClassName: 'demo', 
  cssSuffix: ['.less']
})

Use styl

VitePluginClassName({ 
  prefixClassName: 'demo', 
  cssSuffix: ['.styl']
})

FAQs

Package last updated on 10 Apr 2022

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