Automatically generate gallery.js