Created
September 2, 2017 09:29
-
-
Save netsi1964/00deb99703e8bef8b750176d7e009de7 to your computer and use it in GitHub Desktop.
console snippet: how much in the HTML could be saved if removing HTML comments and newlines?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var source = document.documentElement.innerHTML; | |
var original = source.length | |
var saved = (original-(source.replace(/<!--.*?-->/g,'').replace(/\n/g,'').length)); | |
console.log("This page could be reduced by "+saved+" bytes, which is around "+Math.round(saved/original*100)+"%") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment