I'm using EJS with Node and Express. The HTML produced by my views is large and full of unnecessary whitespace. Is there an option or middleware I can use in production that will compress the HTML?
E.g.,
<!doctype html>
<html><head><title>...</title>....</html>
Your template engine should have a flag that you pass to it to compress it, I know that Jade does it by default (I haven't used EJS).
But I wouldn't bother with whitespace removal, instead I'd use a gzip library to gzip the response down, something like gzippo is what you're after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With