Skip to content

didi0613/basic-shorten-css

Repository files navigation

Enable shorten CSS class names for CSS Module

This is a basic Electrode App for shorten css class names for css modules.

Note: Electrode App with css modules

Originally electrode app is using CSS module generates class names like this:

{noformat}
.skeleton__offset-by-four___1X84H.skeleton__columns___1A5LB
{noformat}

However, to shrink the size under production env, we can renaming CSS class names at the compilation time like:

{noformat}
.___1X84H.___1A5LB
{noformat}

CSS bundle sizes

I would like to share the results of enabling the shorten CSS class names for CSS Module based on this app.

In the production environment, css bundle size decreased from 13.2kb to 9.94kb, which is roughly 24.8% decreased.

Original css bundle size:

Current css bundle size:

CSS names

development env

production env

app demo

References

blog

electrode archetype changes