For a full comparison of minifiers, jump to https://methodfish.com/Articles/minifiers

JSqueeze (adjusted to work with php8+)

This is a demonstration of the javascript minifier using JSqueeze (adjusted to work with php8+) class

Input javascript:

Output:

/*!
 * This is an important comment
 * Date: 27-27
 */
;var _var1=123,_var2='abc';const _CONST1=1234;const _CONST2=9876;let _let1=123;let _let2=987;function getElemInfo(l){var a=123,c=345;let locallet1='abc';let locallet2='def';const localconst3=!0;const localconst4=!1;var e=locallet2.replace(/'/,'abc'),t=99;if(l==!1){return'NULL'};if(l==window){return'window'};var o='';if(l.tagName){o=o+' tag='+l.tagName};if(l.id){o=o+' id='+l.id};if(l.className){o=o+' class='+l.className};if(localconst3)console.log('localconst3=true');else console.log('localconst3=false');if(1==2)console.log('1==2');else{console.log(`1<>2`)};doSomething('Lorem Ipsum // Delor */');doSomething('Lorem "Ipsum" // Delor */');let myPet='seahorse';console.log('My favorite animal is the ${myPet};.');return o};

Minify time: 0.005 seconds; 781 bytes 58.24% of original size (from 1341 bytes).