Skip to content

getLocalIdent to dasherize file name #607

@dagda1

Description

@dagda1

My css loader looks like this:

      {
        test: /\.scss$/,
        exclude: /node_modules/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              query: {
                modules: true,
                sourceMap: true,
                importLoaders: 2,
                localIdentName: '[name]__[local]___[hash:base64:5]'
              }
            },
            'sass-loader',
            {
              loader: require.resolve('postcss-loader'),
              options: postcssOptions
            }
          ]
        })
      },

So if I have a file named TextArea.scss then my class name is, for example TextArea__default___1qzfC.

I would like to use getLocalIdent to dasherize TextArea.scss int text-area__default___1qzfC but I am unfamiliar with the syntax.

Could someone point out, how I do this and I cannot find a single example anywhere online apart from the readme which returns a string literal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions