跳到正文

Interface: CssOptions

Defined in: src/features/css/index.ts:3

Properties

fileName?

ts
optional fileName: string;

Defined in: src/features/css/index.ts:16

Specify the name of the CSS file.

Default

ts
'style.css'

lightningcss?

ts
optional lightningcss: LightningCSSOptions;

Defined in: src/features/css/index.ts:53

Lightning CSS options for CSS syntax lowering and transformations.

Requires @tsdown/css to be installed.


minify?

ts
optional minify: boolean;

Defined in: src/features/css/index.ts:46

Enable/disable CSS minification.

Requires @tsdown/css to be installed.

Default

ts
false

postcss?

ts
optional postcss: PostCSSOptions;

Defined in: src/features/css/index.ts:67

PostCSS configuration.

  • string: Path to the directory to search for PostCSS config files.
  • object: Inline PostCSS options with optional plugins array.
  • Omitted: Auto-detect PostCSS config from the project root.

Only used when transformer is 'postcss'. Requires postcss and @tsdown/css to be installed.

See

https://github.com/postcss/postcss


preprocessorOptions?

ts
optional preprocessorOptions: PreprocessorOptions;

Defined in: src/features/css/index.ts:37

Options for CSS preprocessors (Sass/Less/Stylus).

In addition to options specific to each processor, additionalData option can be used to inject extra code for each style content.

Requires @tsdown/css to be installed.


splitting?

ts
optional splitting: boolean;

Defined in: src/features/css/index.ts:10

Enable/disable CSS code splitting. When set to false, all CSS in the entire project will be extracted into a single CSS file. When set to true, CSS imported in async JS chunks will be preserved as chunks.

Default

ts
false

target?

ts
optional target: string | false | string[];

Defined in: src/features/css/index.ts:27

Set the target environment for CSS syntax lowering. Accepts esbuild-style target strings (e.g., 'chrome99', 'safari16.2'). Defaults to the top-level target option.

Requires @tsdown/css to be installed.

See

https://vite.dev/config/build-options#build-csstarget


transformer?

ts
optional transformer: "postcss" | "lightningcss";

Defined in: src/features/css/index.ts:83

CSS transformer to use. Controls how CSS is processed:

  • 'lightningcss' (default): @import handled by Lightning CSS bundleAsync(), PostCSS is not used at all.
  • 'postcss': @import handled by postcss-import, PostCSS plugins applied, Lightning CSS used only for final targets/minify transform.

Requires @tsdown/css to be installed.

Default

ts
'lightningcss'

See

https://vite.dev/config/shared-options#css-transformer

Released under the MIT License.