Options
All
  • Public
  • Public/Protected
  • All
Menu

rollup-plugin-styles's full option list

Hierarchy

  • Options

Index

Properties

alias?: Record<string, string>

Aliases for URL and import paths

  • ex.: {"foo":"bar"}
autoModules?: boolean | RegExp | ((id: string) => boolean)

Automatically enable CSS Modules for files named [name].module.[ext] (e.g. foo.module.css, bar.module.stylus), or pass your own function or regular expression

default

true

config?: boolean | PostCSSConfigLoaderOptions

Enable/disable or pass options for PostCSS config loader

default

true

dts?: boolean

Generate TypeScript declarations files for input style files

default

false

exclude?: null | string | RegExp | readonly (string | RegExp)[]

Files to exclude from processing

extensions?: string[]

PostCSS will process files ending with these extensions

default

[".css", ".pcss", ".postcss", ".sss"]

import?: boolean | ImportOptions

Enable/disable or pass options for CSS @import resolver

default

true

include?: null | string | RegExp | readonly (string | RegExp)[]

Files to include for processing

Options for Less loader

loaders?: Loader<Record<string, unknown>>[]

Array of custom loaders

minimize?: boolean | Options

Enable/disable or pass options for cssnano

default

false

mode?: "inject" | ["inject"] | ["inject", InjectOptions | ((varname: string, id: string) => string)] | "extract" | ["extract"] | ["extract", string] | "emit" | ["emit"]

Select mode for this plugin:

  • "inject" - Embeds CSS inside JS and injects it into <head> at runtime. You can also pass options for CSS injection. Alternatively, you can pass your own CSS injector.
  • "extract" (default) - Extract CSS to the same location where JS file is generated but with .css extension. You can also set extraction path manually, relative to output dir/output file's basedir, but not outside of it.
  • "emit" - Emit pure processed CSS and pass it along the build pipeline. Useful if you want to preprocess CSS before using it with CSS consuming plugins.
default

"extract"

modules?: boolean | ModulesOptions

Enable/disable or pass options for CSS Modules

default

false

namedExports?: boolean | ((name: string) => string)

Use named exports alongside default export. You can pass a function to control how exported name is generated.

default

false

parser?: string | Parser<default | default>

Set PostCSS parser, e.g. sugarss. Overrides the one loaded from PostCSS config file, if any.

plugins?: Record<string, unknown> | (undefined | null | string | AcceptedPlugin | [string | PluginCreator<unknown>] | [string | PluginCreator<unknown>, Record<string, unknown>])[]

A list of plugins for PostCSS, which are used before plugins loaded from PostCSS config file, if any

preserveStyleImport?: boolean

保留样式引入:只在 preserveModules为true并且mode为extract时生效 生效时,样式文件不会被合并,并且会在js chunk中保留样式的引入语句

default

false

Options for Sass loader

sourceMap?: boolean | "inline" | [boolean | "inline"] | [boolean | "inline", SourceMapOptions]

Enable/disable or configure sourcemaps

default

false

stringifier?: string | Stringifier

Set PostCSS stringifier. Overrides the one loaded from PostCSS config file, if any.

Options for Stylus loader

syntax?: string | Syntax

Set PostCSS syntax. Overrides the one loaded from PostCSS config file, if any.

to?: string

to option for PostCSS, required for some plugins

url?: boolean | UrlOptions

Enable/disable or pass options for CSS URL resolver

default

true

use?: string[]

Array of loaders to use, executed from right to left. Currently built-in loaders are:

  • sass (Supports .scss and .sass files)
  • less (Supports .less files)
  • stylus (Supports .styl and .stylus files)
default

["sass", "less", "stylus"]

Methods

  • Function which is invoked on CSS file extraction. Return boolean to control if file should be extracted or not.

    Parameters

    Returns boolean

  • onImport(code: string, id: string): void
  • Function which is invoked on CSS file import, before any transformations are applied

    Parameters

    • code: string
    • id: string

    Returns void

Generated using TypeDoc