Options for CSS Modules

interface ModulesOptions {
    exportGlobals?: boolean;
    failOnWrongOrder?: boolean;
    generateScopedName?:
        | string
        | (name: string, file: string, css: string) => string;
    mode?: "global" | "local" | "pure";
}

Properties

exportGlobals?: boolean

Export global classes

failOnWrongOrder?: boolean

Fail on wrong order of composition

generateScopedName?:
    | string
    | (name: string, file: string, css: string) => string

Placeholder or function for scoped name generation. Allowed blocks for placeholder:

  • [dir]: The directory name of the asset.
  • [name]: The file name of the asset excluding any extension.
  • [local]: The original value of the selector.
  • [hash(:<num>)]: A hash based on the name and content of the asset (with optional length).
"[name]_[local]__[hash:8]"
mode?: "global" | "local" | "pure"

Default mode for classes

"local"