I'm not sure if modifying the compiled templates would be the way to do that since they contain a lot of PHP within them (would definitely make any php errors that come from templates for whatever reason much more painful to debug as well). Might be easier to minify the rendered output before serving it, I wouldn't think that there would be any sort of noticeable performance implication to doing it then, but I haven't tried it.