
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
mangle-css-class-webpack-plugin
Advanced tools
Minifies and obfuscates the class names in your existing JavaScript, CSS, and HTML without any modern css modules.
Minifies and obfuscates the class names in JavaScript, CSS, and HTML
npm i --save-dev mangle-css-class-webpack-plugin
yarn add --dev mangle-css-class-webpack-plugin
The plugin will generate optimized class name in HTML, JavaScript, and CSS files. configure as follows:
webpack.config.js
const MangleCssClassPlugin = require('mangle-css-class-webpack-plugin');
module.exports = {
...
plugins: [
new MangleCssClassPlugin({
classNameRegExp: '[cl]-[a-z][a-zA-Z0-9_]*',
log: true,
}),
],
};
This will replace class name matched regex in HTML, JavaScript, CSS files. Identify the class names not to match unexpected words since it replaces all words that are matched with the classNameRegExp
.
I suggest that your class names have specific prefix or suffix that identified as a class name.
e.g. '(xs:|md:)?[cl]-[a-z][a-zA-Z0-9_]*'
the sample regexp maches l-main
, c-textbox
, md:l-main__header
, xs:c-textbox__input
, and so on...
The prefix will be ignored from mangling.
e.g. ['xs:', 'md:']
In this case, xs:c-textbox__input
becomes xs:a
.
<!-- html -->
<main class='l-abc'>
<div class='l-efg' />
</main>
// js
document.querySelector('l-efg');
// css
.l-abc {
}
.l-abc .l-efg {
}
<!-- html -->
<main class='a'>
<div class='b' />
</main>
// js
document.querySelector('b');
// css
.a {
}
.a .b {
}
FAQs
Minifies and obfuscates the class names in your existing JavaScript, CSS, and HTML without any modern css modules.
The npm package mangle-css-class-webpack-plugin receives a total of 494 weekly downloads. As such, mangle-css-class-webpack-plugin popularity was classified as not popular.
We found that mangle-css-class-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.