Pages

HTML Minifier



HTML Minifier Tool — Responsive

HTML Minifier Tool

Paste HTML, remove comments & whitespace, minify inline CSS/JS, preview & download — all in your browser.

Original0 B
Minified0 B
Ratio0%
\n\n`; updatePreview(input.value); countStats('', input.value); }); resetBtn.addEventListener('click', ()=>{ input.value = ''; updatePreview(''); countStats('', ''); }); copyBtn.addEventListener('click', doCopy); downloadBtn.addEventListener('click', ()=> doDownload('minified.html', input.value)); downloadRawBtn.addEventListener('click', ()=> doDownload('original.html', $('#inputHtml').value)); analyzeBtn.addEventListener('click', analyze); // Auto minify on changes let autoTimer = null; input.addEventListener('input', ()=>{ const val = input.value; if(autoMinify.checked){ clearTimeout(autoTimer); autoTimer = setTimeout(()=>{ doMinify(); }, 700); } else { // update preview live without minifying (render input) updatePreview(val); countStats(val,val); } }); // initial render window.addEventListener('load', ()=>{ updatePreview(input.value); countStats(input.value, input.value); }); // keyboard shortcuts window.addEventListener('keydown', (e)=>{ if((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'm'){ e.preventDefault(); doMinify(); } if((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'b'){ e.preventDefault(); doBeautify(); } });

No comments:

Post a Comment