GZIP 'data' contents before uploading to SPIFFS partition with platformio

Nogla1
Posts: 3
Joined: Sun Jul 14, 2019 10:19 am

GZIP 'data' contents before uploading to SPIFFS partition with platformio

Postby Nogla1 » Sun Jul 14, 2019 10:39 am

I found that it's possible to compress HTML, CSS, JS files from 'data' folder before uploading its contents to the board with platformio.
To do that, one should create extra_script.py at the same level as platformio.ini and put some code in it.

Code: Select all

# custom action before building SPIFFS image. For example, compress HTML, etc.
env.AddPreAction("$BUILD_DIR/spiffs.bin", callback...)
I have two files in 'data' folder
1. favicon.ico
2. index.html

I wonder how my extra script code should look like if I want to have the following file structure on the SPIFFS partition after uploading an image:
1. favicon.ico
2. index.html.gz

I'm using W10, VSCode with platformio 4 addon for writing, building and uploading OTA firmware and partition images, if it's important.

Who is online

Users browsing this forum: No registered users and 76 guests