On this page

class CssParser extends Parser
Source Code: lib/css/CssParser.js#L866
new CssParser(): CssParser
Returns:CssParser
Source Code: lib/css/CssParser.js#L873
Type:"global" | "local" | "auto" | "pure"
Source Code: lib/css/CssParser.js#L890
Type:Context
Source Code: lib/css/CssParser.js#L875
Type:Object
Type:boolean

Enable/disable renaming of @keyframes.

Type:string

Configure how the CSS source is parsed: as a full stylesheet (default) or as a block's contents (e.g. the content of an HTML style attribute).

Type:boolean

Enable/disable renaming of @container names.

Type:boolean

Enable/disable renaming of custom identifiers.

Type:boolean

Enable/disable resolution of @custom-media at-rules (file-local build-time substitution).

Type:boolean

Enable/disable resolution of @custom-selector at-rules (file-local build-time expansion to :is(...)).

Type:boolean

Enable/disable renaming of dashed identifiers, e. g. custom properties.

Type:"global" | "local" | "auto" | "pure"

default mode

Type:"link" | "text" | "css-style-sheet" | "style"

Configure how CSS content is exported as default.

Type:boolean

Auto-emit <link rel="preload" as="font"> for the primary src URL of each @font-face reachable from an HTML entry's initial CSS. Only the first URL per @font-face is preloaded (preloading every format would double-download). Off by default; parser.css.urlHints rules and per-URL magic comments still override the seeded defaults. Set output.crossOriginLoading so the preload matches the font's CORS fetch.

Type:boolean

Enable/disable renaming of @function names.

Type:boolean

Enable/disable renaming of grid identifiers.

Type:boolean

Enable/disable @import at-rules handling.

Type:boolean

Use ES modules named export for css exports.

Type:boolean

Enable strict pure mode: every selector must contain at least one local class or id selector.

Type:boolean

Enable/disable url()/image-set()/src()/image() functions handling.

URL-referenced-asset default hint rules for this parser (JavaScript new URL(...), CSS url(...), HTML <img src> / <link href> / <script src>).

cssParser.parse(source, state): ParserState
Source Code: lib/Parser.js#L35
Attributes
source:string | Buffer<ArrayBufferLike> | PreparsedAst
Returns:ParserState

Parses the provided source and updates the parser state.