0.1.8 • Published 8 months ago

vite-plugin-basic-css-selector v0.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

vite-plugin-basic-css-selector

NPM version

Usage

playground

Install

npm install vite-plugin-basic-css-selector -D

Add it to vite.config.js

import { defineConfig } from 'vite'
import BasicCssSelector from 'vite-plugin-basic-css-selector'

export default defineConfig({
  plugins: [
    BasicCssSelector('.basic'),
  ],
})

It will produce the following effect:

Origin CSS code:

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vanilla:hover {
  filter: drop-shadow(0 0 2em #3178c6aa);
}

.card {
  padding: 2em;
}

.read-the-docs {
  color: #888;
}

Transform CSS code:

.basic .logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.basic .logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.basic .logo.vanilla:hover {
  filter: drop-shadow(0 0 2em #3178c6aa);
}

.basic .card {
  padding: 2em;
}

.basic .read-the-docs {
  color: #888;
}

Options

import type { Plugin } from 'vite'

interface Options {
  enforce?: Plugin['enforce']
  apply?: Plugin['apply']
  /**
   * support html element tags
   * @default false
   */
  enableElementTag?: boolean
  /**
   * support universal selector '*'
   * @default false
   */
  enableUniversal?: boolean
}
0.1.8

8 months ago

0.1.7

8 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.4

8 months ago

0.1.3

8 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago

0.0.0

9 months ago