You want to write code in webcenter resources that's re-usable accross all instances (DEV-TEST_UAT-PROD).
Ensure you reference all UCM resources with either a single '/', or a double '//' at the start of the relative reference. A good way to get all your images to load is to use single slash for all of them, and those that don't load maybe in a content presenter template or other, use the double slash.
Word to the wise, slash first. Not to get slashed later.