Given that uglification involves some minification in the process, does it still make sense to do both minify and uglify? If yes, should one minify or uglify first? Is it enough to do uglify only? Will the code be more obfuscated if both are done?
Uglification improves performance while reducing readability. Encryption: This is the process of translating data, called plain data, into encoded data. This encrypted, or encoded, data is known as ciphertext, and needs a secret key in order to decrypt it.
Despite being an excellent programming language, JavaScript impacts web pages by slowing them down. To regain space and improve your page load speed, you must minify the JavaScript code. The minified version of JavaScript code can reduce the file size by as much as 30–90%.
Minification is the process of minimizing code and markup in your web pages and script files. It's one of the main methods used to reduce load times and bandwidth usage on websites. Minification dramatically improves site speed and accessibility, directly translating into a better user experience.
Minification is just removing unnecesary whitespace and redundant / optional tokens like curlys and semicolons, and can be reversed by using a linter. Uglification is the act of transforming the code into an "unreadable" form, that is, renaming variables/functions to hide the original intent...
There is no real distinction between the two. Even Uglify calls itself a minification toolkit.
The distinction could be more relevant when comparing JS minification to CSS minification - CSS minification involves only removing whitespace - the original code remains intact.
With JS it is possible to not only remove whitespace, but also to make transformations to the code, such as truncating variable names to single characters.
Minifying JavaScript not only makes the source smaller, it also makes the code less readable, or obfuscates it. But do not operate under the assumption that minification or uglification, or whatever you want to call it, is a security measure. It isn't encryption. The code is harder to read, but not impossible to read, and while it's not usually possible to return minified code back to its original form, it is possible to 'beautify' it and make it more readable.
It doesn't make sense to both minify and uglify because most minifiers will both remove whitespace and unnecessary characters, as well as obfuscate the code. All you're doing is introducing another build step.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With