How to link Angular project dist directory to PlatformIO SPIFFS data directory
For tips how to make the Angular build small enough to fit into the SPIFFS image, see How to make Angular work with ESP32 SPIFFS / ESPAsyncWebserver
When you are building a PlatformIO image, you can easily make the dist/[project_name] directory from the Angular project directory appear in the SPIFFS image by using a symlink.
My config tells the server to serve from the www subdirectory.
serve_static_example.cpp
server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html");Therefore, we first need to create the data directory in the same directory where platformio.ini is located:
create_data_dir.sh
mkdir dataNow we can create a symlink from the angular dist directory to data/www, for example**:**
create_symlink.sh
ln -s ../MyUI/dist/myui data/wwwPlatformIO will automatically handle the symlink, if the directory exists.
Check out similar posts by category:
Angular, ESP8266/ESP32, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow