template generation for --single files
same thing, another way
opportunity for more optimisation