how to make friends 'localIdentName' in css-loader with html files, using webpack?

633 Views Asked by At

I want to use webpack with css-loader with option 'localIdentName' and of course to use the hash of class names

but I'm not use React or a like libraries for DOM

my webpack rules

{
    test: /\.scss$/,
    use: [
      { loader: 'style-loader' },
      {
        loader: 'css-loader',
        query: {
          modules: true,
          sourceMap: !optimize,
          minimize: optimize,
          importLoaders: 2,
          localIdentName: '[local]__[hash:base64:5]',
        },
      },
      {
        loader: 'sass-loader',
        options: {
          sourceMap: !optimize,
          includePaths: [path.resolve(sourcePath, './global_styles')],
        },
      },
    ],
  },
  { test: /\.html$/, use: 'html-loader' }

And some code from index.html

<div class="city-name">NNOV</div>

And some scss rule

.city-name {
  font-size: 32px;
  font-weight: 300;
  line-height: .85;
}

And with webpack config I've got class name city-name__SOME-HASH, but inside index.html will remain city-name

How to be ? It is possible to update class names in index.html too ?

0

There are 0 best solutions below