Compressing large html with style and script tags
See original GitHub issuevar express = require('express')
var compression = require('compression')
var app = express()
app.use(compression())
app.get('*', renderHTML)
function renderHTML() {
res.status(200).send( { humongous HTML file with style and script tags } )
}
I’ve followed the docs and received a response that has a content-encoding = ‘gzip’ flag on it. However, the size of the response is the same as when I comment out all the compression code. Gzip-checking websites also tell me that the response really isn’t gzipped.
The humongous HTML content is populated after going through several other APIs and collecting a bunch of data.
Could the issue be due to the HTML response containing css and javascript that isn’t being gzipped? Do I have to separate the content I’m sending?
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Reduce the size of HTML, CSS, JavaScript, PHP and Smarty ...
Select a x/html code type in such case. Select CSS when you want to compress just Cascading Style Sheets (CSS) code as it...
Read more >How to compress HTML and other website code - Ryte
Both methods are great for compressing HTML, CSS, and JavaScript files. In addition, minifying is another useful way to keep the code slim....
Read more >What is the best method to reduce the size of my Javascript ...
Try web compressor tools from Boryi to compress your standard HTML file (without Javascript code and css code embedded, but ...
Read more >How to Optimize HTML to Boost Web Performance
HTML Delivery Tip #1: Clean up HTML so it is concise · Don't use inline styles. · Don't use inline scripts. · Reduce...
Read more >Reduce HTML5 file size - Studio Help - Google Support
An HTML5 creative commonly refers to ads created with HTML, CSS, and JavaScript. ... The size of the Enabler script is 25 KB...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If
Content-Encoding
isgzip
, then it is compressed. Chrome’s size column is bugged in that if a response isTransfer-Encoded: chunked
it will show the decompressed size there instead of what was over the network. Use Wireshark to measure what was actually going over the network, please.The uncompressed size is 318255 bytes but if you look at the network traffic over Wireshark, you’ll see the server is sending the binary gzip and that it’s only 43533 bytes.