The illustrations in my book are drawn using tools such as CAD or Affinity Designer, then exported as .svg and .pdf for use by PreTeXt. For my own sanity these files are all stored in a ‘resources’ directory organized somewhat hierarchically with related images together and source files located alongside their derived image files. Geogebra, css, and javascript files are organized in their own folders here too.
My preprocessing script walks the ‘resources’ folder, flattens the hierarchy, copies all the [ .svg .png, .pdf, and .ggb] files into the "external/images’’ folder while filtering out files with other extensions. GGB, CSS and JS files folders just are simply copied, and folders with names beginning with underscore are ignored. This way all the images are in the same directory and files not needed for the output aren't published. In a sense, I am generating the external folder from my source documents.
I can certainly do this with a makefile -- that’s how I was doing it before -- but the pretext-cli does such a nice job moving files to the right places and running the right scripts that my makefile got very simple, and I hoped to be able to get rid of it completely.
Will