Build filesystem image: exclude files from buildfs

When building the FS image, files are collected from the data/ directory.
But I’m building some of them before building the filesystem itself (templating, HTML, CSS etc) and I would like to exclude “source” files from the FS build.

I tried adding src_filter = -<*.slim> in my platformio.ini for .slim files are still added.

Any clue on how to have a “.buildignore”-like ?

Thank you

This only affects C/C++/ASM source files for the firmware, not the filesystem. PlatformIO has no filter option for the filesystem build. Every file that is in the data/ directory (or more generally $PROJECT_DATA_DIR) at the point the DataToBin builder is executed will be included in the filesystem. See source and source.

Which means that either

  1. file a feature request in Issues · platformio/platform-espressif32 · GitHub
  2. or, use advanced scripting and a Pre action to the littefs.bin / spiffs.bin build in which you move all non-wanted files out of the data/ directory before the conversion is done, and back in after the conversion is done (Post action). See documentation.

Thank you for your quick reply @maxgerhardt !

Two options for my situation:

  1. put my files in src/data and, at build-time, rsync files with an include/exclude filter to data/ which is being built and shipped
  2. permanent files stay in data/ and build-time files are cleaned up before each build, and build again from src/data to data/

Hope this helps anyone else