Is obfuscation of JavaScript possible in Hugo?

Hello.

This isn’t an issue, but, I was just wondering.

Is it possible to minify JavaScript down to its least size, which generally includes converting function and variable names to single alphabets. I have seen such code in almost all JavaScript libraries and I’m not really sure what it’s called or how it’s done. I have found something called YUI Compressor that seems to be doing this.

My point being, if it’s currently not supported, would it be considered for a future release? It does bring the size of JavaScript down to its last size.

However, I also think that it might not help much as JavaScript libraries that people generally use are already minified and if someone, has some self-written JavaScript, it’s probably not going to be much in size. I’m speaking from my personal experience. My self-written JS is about 4 KB minified. So, this further compression might bring it down by a few bytes or 1 KB max. But then, it might be a good to have feature.

It’s called uglify.js, and I am pretty sure it’s possible to use somehow via postcss plugin.

I think I might have it configured somewhere in an older website before I started caching indefinitely and minifying with Hugo. I’ll go look for it.

1 Like

One selling point of Hugo for me is that, a lot is possible without node_modules. But, thanks for pointing in the right way.

If you cook (properly), there will be scrapes.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.