Close

ESP-Gzip Webpage compression

A project log for AirCore - Plug n' Play Wireless Serial

A lightweight module providing high speed WiFi data transfer. Native support for most uC. Clean and easy to use. ESP8266 based.

cristian-dobreCristian Dobre 02/24/2016 at 14:540 Comments

I finally took the time this week to refine my ESP-Gzip utility which I use to minify the website which will represent the user interface of the AirCore module. I have removed the 7za dependency and the compression is now done using node's own zlib API.

Reducing payload

The purpose of this utility is to reduce the website payload as much as possible by minifying and then compressing webpages using gzip. For example, the source website has 3712 bytes which the compressed file reduces to 1629 bytes. That means it's size has been reduced by more than 60 percent.

First served webpage

Even though I plan to develop a one page app to configure the ESP8266, I hate writing CSS and JS inside a single HTML webpage. That's why the utility supports inlining the resources at generation time, by including the #inline directive. This also minimizes the number of HTTP requests.

<link href="css/styles.css#inline" rel="stylesheet">
<script src="js/script.js#inline"></script>
There are of course, disadvantages of using this method:

For HTTP interactions, I've published the esp_http library on GitHub. For now, it only supports HTTP requests.

Discussions