
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
a-webpack-plugin
Advanced tools
Isomorphic (universal) css supershort classNames generator for webpack.
If you are crazy need for mobile speed super optimizator, you may want to shortinize your classNames in a hardcore ultimate way:
<div class="mz nb">
<label class="ea">
<span class="ej em el eo">Some text</span>
<input name="phoneNumber" label="Phone" class="ed eg ef">
</label>
<div class="nh ni">
<span class="mr">Some other text</span>
</div>
</div>
a-webpack-plugin is not stable for now, use it at your own risk)
But it works)
What the problem? Why cant I just use APlugin.getClassName for getLocalIdent?
Well, the problem is that webpack doesn't guarantee you an order in which css files are processed through loaders. Because of that:
a-webpack-plugin solves this order problem.
First, you should use css-loader
Install a-webpack-plugin plugin
npm i a-webpack-plugin --save-dev
Then add three lines of code to your webpack config(s)
const APlugin = require('a-webpack-plugin') // 1
...
const config = {
rules: {
test: /\.(css)$/,
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: {
modules: true,
getLocalIdent: APlugin.getClassName, // 2 â define `ab` classnames generator
},
},
'postcss-loader',
],
}
...
plugins: [
new APlugin(), // 3
...
],
...
}
Same if you use ExtractTextPlugin
const APlugin = require('a-webpack-plugin') // 1
...
const config = {
rules: {
test: /\.(css)$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
modules: true,
getLocalIdent: APlugin.getClassName, // 2
},
},
'postcss-loader',
],
}),
}
...
plugins: [
new APlugin(), // 3 â Before ExtractTextPlugin!
new ExtractTextPlugin(),
...
],
...
}
If you have server-side rendering, dont forget to do the same thing for your server-side bundle.
If you use css-require-hook instead of webpack-bundling for server-side, you cannot use a-webpack-plugin for now (but you will be able to do that in near future!).
Default alphabet is
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789
ClassName cannot start with - or _ or digit.
You can customize alphabet:
new APlugin({ alphabet: 'abc' })
Read more about incstr package.
In development, it is important to reload the server (if you have one) each time you change your html/css, because any new css className may change all other classNames.
Other option is to use mode=development for development, and mode=production for production:
new APlugin({ mode: 'development' })
Default value of mode option is process.env.NODE_ENV || 'production'.
Also, production mode may slow down your re-build process, if your project is super big.
FAQs
Supershort (a, b, c, ... zz) css classNames generator
The npm package a-webpack-plugin receives a total of 0 weekly downloads. As such, a-webpack-plugin popularity was classified as not popular.
We found that a-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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.