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

MatthiasMullie

This is a demonstration of the javascript minifier using MatthiasMullie class

Input javascript:

Output:


/*!
 * This is an important comment
 * Date: 27-27
 */
var _var1=123;var _var2='abc';const _CONST1=1234;const _CONST2=9876;let _let1=123;let _let2=987;function getElemInfo(elem){var localvar1=123;var localvar2=345;let locallet1='abc';let locallet2='def';const localconst3=!0;const localconst4=!1;var test=locallet2.replace(/'/,'abc');var c=99;if(elem==!1){return'NULL'}
if(elem==window){return'window'}
var newTx='';if(elem.tagName){newTx=newTx+' tag='+elem.tagName}
if(elem.id){newTx=newTx+' id='+elem.id}
if(elem.className){newTx=newTx+' class='+elem.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 newTx}

Minify time: 0.0067 seconds; 872 bytes 65.03% of original size (from 1341 bytes).