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.