html text output compression from rails (or apache/passenger)

670 views Asked by At

i have a quite strange request: i want to "compress" all the output from a rails app; with this i do not mean gzip or any similar compression, i mean to reformat the whole output (preferably with apache/passenger but can also be a rack middleware or rails plugin)

anyone knows if something like this exists? any apache module out there? if not, what would be a good way to implement something like this?

just to be more clear what i want:

<html>
    <head>
        <title>page title</title>
    </head>
    <body>
    info!
    <!-- my comment -->
    </body>
</html>

should become

<html><head><title>page title</title></head><body>info!<!-- my comment --></body></html>

ideally, also comments and other shenanigans are removed, so ideally it would look like this

<html><head><title>page title</title></head><body>info!</body></html>

again, just to avoid having mod_deflate or gzip discussions again: i know that such things as gzip compressors exists. i am specifically searching for a way to text-filter with apache or rails (rack).

thanks for any pointers!

1

There are 1 answers

1
TK-421 On

This may not be feasible, but how about a deployment task that "cleans" all your templates?