. * * $URL: http://code.google.com/p/paintweb $ * $Date: 2009-07-02 20:49:18 +0300 $ */ // This file takes an XHTML/HTML file as input, and outputs a minified string, // which basically only has all the comments stripped and any leading // whitespace. // Obviously, I could use PHP DOM ... but based on experience it's kinda flimsy. // Sure, this is flimsy as well - yet I control the flimsyness. $content = ''; while(!feof(STDIN)) { $content .= fgets(STDIN, 4096); } echo trim(preg_replace( array('//ms', '/^\s+/m', '/[\n]+/m'), array('', ' ', ' '), $content)); // vim:set spell spl=en fo=anl1qrowcb tw=80 ts=2 sw=2 sts=2 sta et noai nocin fenc=utf-8 ff=unix: ?>