Options
All
  • Public
  • Public/Protected
  • All
Menu

rollup-plugin-styles's full option list

Hierarchy

  • Options

Index

Properties

Optional alias

alias?: Record<string, string>

Aliases for URL and import paths

  • ex.: {"foo":"bar"}

Optional autoModules

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

false

Optional config

config?: boolean | PostCSSConfigLoaderOptions

Enable/disable or pass options for PostCSS config loader

default

true

Optional dts

dts?: boolean

Generate TypeScript declarations files for input style files

default

false

Optional exclude

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

Files to exclude from processing

Optional extensions

extensions?: string[]

PostCSS will process files ending with these extensions

default

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

Optional import

import?: boolean | ImportOptions

Enable/disable or pass options for CSS @import resolver

default

true

Optional include

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

Files to include for processing

Optional less

Options for Less loader

Optional loaders

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

Array of custom loaders

Optional minimize

minimize?: boolean | CssNanoOptions

Enable/disable or pass options for cssnano

default

false

Optional mode

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

Select mode for this plugin:

  • "inject" (default) - 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" - 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

"inject"

Optional modules

modules?: boolean | ModulesOptions

Enable/disable or pass options for CSS Modules

default

false

Optional namedExports

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

Optional parser

parser?: string | Parser<default | default>

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

Optional plugins

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

Optional sass

Options for Sass loader

Optional sourceMap

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

Enable/disable or configure sourcemaps

default

false

Optional stringifier

stringifier?: string | Stringifier

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

Optional stylus

Options for Stylus loader

Optional syntax

syntax?: string | Syntax

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

Optional to

to?: string

to option for PostCSS, required for some plugins

Optional url

url?: boolean | UrlOptions

Enable/disable or pass options for CSS URL resolver

default

true

Optional use

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

Optional onExtract

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

    Parameters

    Returns boolean

Optional onImport

  • 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