This is the dev preview website. Check out the document at lynxjs.org

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;

Default Value

'[local]-[hash:base64:6]'

Remarks

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]',
    },
  },
})