Remove main.js requirement for themes

This is for #8626.
Hm. That's interesting, as I am not finding `metadata` in the script scope, only in individual functions. Will fix this with your suggestion right now.