Answer the question
In order to leave comments, you need to log in
Minify class names using css-module?
Hello, I decided to try minifying the css class names for a bit of obfuscation and minification.
To do this, I use css-modules with the setting
getLocalIdent: MinimalClassnameGenerator({ length: 1 })
//где MinimalClassnameGenerator — https://github.com/neatsoftware/webpack-minimal-classnames
const N = { class: "super-puper-class" },
$style: {
"super-puper-class": "J",
Answer the question
In order to leave comments, you need to log in
Magic doesn't exist, friend.
What does the webpack loader actually do? It takes some file as input, does something with it and produces a js-module (as a string) with the result + some side effects.
Accordingly, the css-loader for modules does (exaggerated) 2 things:
1. Generates a js module with an object of the form from the input css
{ [ключ - настоящее имя класса]: [значение - минифицированное] }
and gives the result to js. $style.className
with values from these modules. $style[somevar + '__bold']
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question