I’m working on a static site that has a large number of image assets. I have a gulp script that reads a directory of source images, and generates different-sized images from the source images. The gulp script writes all the assets into ‘build/photos/’
When I then run Middleman, it immediately removes all the newly-built images – because they have no counterpart in the source directory, and it therefore assumes that they are old/unwanted.
As far as I can tell, the ‘ignore’ command only tells Middleman not to process files in the ‘source’ directory. Even when I add:
ignore 'photos'
ignore 'photos/**/*.jpg'
the files in ‘build/photos’ are deleted.
I know that there is a ‘–no-clean’ command-line argument that stops Middleman deleting unmatched files in the build directory, but what I’m really looking for is something that could apply to just one location in the build tree.
I could, of course, write my images to ‘source/photos’ and have Middleman copy them across, but this wastes large amounts of disk space.
Is there any way to persuade Middleman not to touch certain subdirectories in the ‘build’ directory?