UNPKG

vite-plugin-pretty-module-classnames

Version:

Adds the filename without the -module suffix to the class names of CSS modules.

15 lines (13 loc) 696 B
import { Plugin } from 'vite'; /** * Adds the filename without the `-module` suffix to the class names of CSS modules. * It customizes the generateScopedName function to use a sanitized version of the filename, class name, and a hash. * If the `lineNumber` option is set to true, the line number is added to the generated class name. * * @prop {Object} `options` - Plugin options. * @prop {boolean} `options.lineNumber` - Whether to include the line number in the generated class name. @default false * @returns {Plugin} A Vite plugin object with a custom configuration for CSS modules. */ export default function PrettyModuleClassnames(options?: { lineNumber?: boolean; }): Plugin;