There aren't really any risks involved aside from the fact that most (all?) compressors expect well-formed scripts, and thus can break ones that don't meet standards.
A common way to do compression that will give you a similar effect is to gzip content from the web server.