GZIP 'data' contents before uploading to SPIFFS partition with platformio
Posted: 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.
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.
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...)
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.