Home > @lynx-js/rspeedy > CssModules > localIdentName

CssModules.localIdentName property

Sets the format of the className generated by CSS Modules after compilation.

Signature:

localIdentName?: string | undefined;

Remarks

The default value is '[local]-[hash:base64:6]' which combines the original class name with a 6-character hash.

Available placeholders:

  • [local]: Original class name

  • [hash]: Hash of the class name

  • [path]: File path

  • [name]: File name

  • [ext]: File extension

See css-loader#localIdentName for details.

Example 1

Use only hash for shorter class names:

import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    cssModules: {
      localIdentName: '[hash:base64:8]',
    },
  },
})

Example 2

Include file name for debugging:

import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    cssModules: {
      localIdentName: '[name]__[local]--[hash:base64:5]',
    },
  },
})