Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Xation's avatar

Obfuscate css class like Facebook and Google

Someone know how to obfuscate the css class with laravel-mix ? I know that I need to add this options

options: {
    modules: true,
    localIdentName: '[name]-[local]-[hash:base64]'
}

But because of the merge of the same rule it's not working. And I'm not strong enough with webpack to resole this problem.

Actual webpack.mix.js

 mix.js('resources/js/main.js', 'public/js')
.sass('resources/sass/app.sass', 'public/css')
.webpackConfig({
  module: {
    rules: [{
        test: /\.s[ac]ss$/,
        exclude: [],
        loaders: ['style-loader', 'css-loader', 'sass-loader']
    }]
  }
});
Invalid CSS after "...load the styles": expected 1
0 likes
1 reply
Xation's avatar
Xation
OP
Best Answer
Level 6

I found the solution :

 .options({
  vue: {
    cssModules: {
      localIdentName: '[name]-[local]-[hash:base64]',
      camelCase: true
    }
  }
});
2 likes

Please or to participate in this conversation.