Minify HTML/PHP

前端 未结 3 1033
广开言路
广开言路 2020-12-18 03:53

I\'m using gzip to compress my html/php files along with js/css/etc. This reduces the payload quite nicely but I also want to \'minify\' my markup of both .html and .php pag

3条回答
  •  别那么骄傲
    2020-12-18 04:39

    Peter Anselmo has confused minification for obfuscation. In code obfuscation the code is minified and variables are renamed to shortest length arbitrary names. Minification is merely the practice of reducing code size, such as white space removal, without altering the values, names, or syntax of code.

    Peter Anselmo is also wrong that minifying markup results in an insignificant savings. This page, for instance, shows a savings of 18.31% and it was pretty tidy to begin with. Clearly, he has never tested his opinion before he put it out there. You can see the cost savings yourself using the Pretty Diff tool at http://prettydiff.com/

    You can attempt to reverse engineer minification engine used by Pretty Diff to execute from PHP. That code and accompanied documentation can be found at: prettydiff.com/markupmin.js

提交回复
热议问题