Home / Type/ CSSOptions Type — vite Architecture

CSSOptions Type — vite Architecture

Architecture documentation for the CSSOptions type/interface in css.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  ac238674_adf2_388f_71ba_6247438eda8f["CSSOptions"]
  c3eb47df_971b_0616_6c9f_29b3ded72224["css.ts"]
  ac238674_adf2_388f_71ba_6247438eda8f -->|defined in| c3eb47df_971b_0616_6c9f_29b3ded72224
  style ac238674_adf2_388f_71ba_6247438eda8f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/css.ts lines 114–165

export interface CSSOptions {
  /**
   * Using lightningcss is an experimental option to handle CSS modules,
   * assets and imports via Lightning CSS. It requires to install it as a
   * peer dependency.
   *
   * @default 'postcss'
   * @experimental
   */
  transformer?: 'postcss' | 'lightningcss'
  /**
   * https://github.com/css-modules/postcss-modules
   */
  modules?: CSSModulesOptions | false
  /**
   * Options for preprocessors.
   *
   * In addition to options specific to each processors, Vite supports `additionalData` option.
   * The `additionalData` option can be used to inject extra code for each style content.
   */
  preprocessorOptions?: {
    scss?: SassPreprocessorOptions
    sass?: SassPreprocessorOptions
    less?: LessPreprocessorOptions
    styl?: StylusPreprocessorOptions
    stylus?: StylusPreprocessorOptions
  }

  /**
   * If this option is set, preprocessors will run in workers when possible.
   * `true` means the number of CPUs minus 1.
   *
   * @default true
   */
  preprocessorMaxWorkers?: number | true
  postcss?:
    | string
    | (PostCSS.ProcessOptions & {
        plugins?: PostCSS.AcceptedPlugin[]
      })
  /**
   * Enables css sourcemaps during dev
   * @default false
   * @experimental
   */
  devSourcemap?: boolean

  /**
   * @experimental
   */
  lightningcss?: LightningCSSOptions
}

Frequently Asked Questions

What is the CSSOptions type?
CSSOptions is a type/interface in the vite codebase, defined in packages/vite/src/node/plugins/css.ts.
Where is CSSOptions defined?
CSSOptions is defined in packages/vite/src/node/plugins/css.ts at line 114.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free