Rename resources and relativize calls to them in JS