Skip to content

A plugin that injects styles into chunks in vite library mode

Notifications You must be signed in to change notification settings

huogui/vite-plugin-lib-inject-style

Repository files navigation

vite-plugin-lib-inject-style npm

The node version must be greater than 16.0.0!does not support ssr!

// vite.config.ts
import VitePluginLibInjectStyle from 'vite-plugin-lib-inject-style'

export default {
  plugins: [VitePluginLibInjectStyle({
    // options ..
  })]
}

Options

export interface PluginOptions {
  /**
   * Insert `<style>` tag(s) to the beginning of the container
   * @default false
   */
  prepend?: boolean
  /**
   * Inject CSS into single `<style>` tag only
   * @default false
   */
  singleTag?: boolean
  /**
   * Container for `<style>` tag(s) injection
   * @default "head"
   */
  container?: string
  /**
   * Set attributes of injected `<style>` tag(s)
   * - ex.: `{"id":"global"}`
   */
  attributes?: Record<string, string>
}

License

MIT

About

A plugin that injects styles into chunks in vite library mode

Resources

Stars

Watchers

Forks

Packages

No packages published