Compressing Large HTML,CSS,JS files in ESP Progmem

Gheotic
Posts: 1
Joined: Thu Feb 15, 2018 10:15 am

Compressing Large HTML,CSS,JS files in ESP Progmem

Postby Gheotic » Thu Feb 15, 2018 10:36 am

I've been trying to find a sufficient way to store, webfiles on the ESP both for the ESP32 and ESP8266. I've tried a few different things so fare: Storing the files in SPIFFS, but was to slow to retrieve the data, and then timed out... Typing the HTML in a simple char array in progmem, but was too pain full process to keep updating it, for every single change in webfiles...

I then came by spacehuhn's esp8266_deauther https://github.com/spacehuhn/esp8266_de ... web_server
where he had clever way of doing it.

By running a .sh file, which took every single file and minified it, then converted it to a huge const char array with the hex values for every single file.

I tried using his version of it, with my own HTML, but without luck... So I instead made my own version written in Python, which did the same thing Github ESP-HTML-Compressor.

It works perfect for HTML files, but not quite with CSS and Javascript files...

After being compressed by the python script, and uploaded on the ESP32 to test, it delivers all the files as expected, but not in the correct format.

Image

What could be the cause of this?

Btw I've a put in an example in my Github project, which could reproduce the problem.

xgarbxgarb
Posts: 21
Joined: Fri Jan 25, 2019 3:36 pm

Re: Compressing Large HTML,CSS,JS files in ESP Progmem

Postby xgarbxgarb » Fri Jan 25, 2019 3:50 pm

Hi,

Possibly one of the minifiers is removing something that is needed. Did you try using the web versions to see if something was stripped from the JS file. Sometimes comments in the code can cause a problem.

I want to go the other way... I want to get the original HTML out of this file:

https://github.com/espressif/arduino-es ... ra_index.h

I imagine it's been gzipped and then turned into a const char array. Any ideas? I've tried various recipes with this: https://gchq.github.io/CyberChef/

boarchuz
Posts: 605
Joined: Tue Aug 21, 2018 5:28 am

Re: Compressing Large HTML,CSS,JS files in ESP Progmem

Postby boarchuz » Mon Jan 28, 2019 12:29 pm

xgarbxgarb wrote:
Fri Jan 25, 2019 3:50 pm
I want to go the other way... I want to get the original HTML out of this file:

https://github.com/espressif/arduino-es ... ra_index.h
Run the sketch, connect to server, load page, save it.

xgarbxgarb
Posts: 21
Joined: Fri Jan 25, 2019 3:36 pm

Re: Compressing Large HTML,CSS,JS files in ESP Progmem

Postby xgarbxgarb » Mon May 06, 2019 9:21 am

In the end I used the CyberChef website to convert the HTML to the format I needed. I put it on my blog here: https://robotzero.one/esp32-cam-custom-html/

Who is online

Users browsing this forum: No registered users and 51 guests