0.1.2-beta.1 • Published 2 years ago

vite-plugin-color v0.1.2-beta.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

English | 中文文档

Usage

Install

node version: >= 14.0.0

vite version: >= 2.0.0

yarn add vite-plugin-color -D

or

npm i vite-plugin-color -D

Config

Add it to vite.config.js

// vite.config.js
import viteColor from 'vite-plugin-color'

export default {
  plugins: [
    viteColor([
      {
        extract: ['#eee'],
        output: 'themes/triple-e.css',
        injectTo: 'head'
      }
    ])
  ]
}

Options

The parameters can be a single object or an array of objects.

export interface propType {
  // The color value that needs to be extracted.
  // Inline styles or styled are not supported at this time.
  extract: string[]
  // The handler of the matching content
  transform?: (code: string) => string
  // External css file links like 'cdn'
  external?: string[]
  // The file output path
  output?: string
  // Whether to minify. @default true
  minify?: boolean
  // Minify options,follow `clean-css`
  minifyOptions?: OptionsPromise
  // Production environment auto-injects loaded css,
  // supports customization, follows `vite HtmlTagDescriptor`
  injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend' | HtmlTagDescriptor
}

export type optionType = Array<propType> | propType

License

MIT

0.1.2-beta.1

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago