A large number of extremely low-mass helium white dwarfs (ELM WDs) have been discovered in recent years. The majority of them are found in close binary systems suggesting they are formed either through a common-envelope phase or via stable mass transfer in a low-mass X-ray binary (LMXB) or a cataclysmic variable (CV) system. Here, we investigate the formation of these objects through the LMXB channel with emphasis on the proto-WD evolution in environments with different metallicities. We study for the first time the combined effects of rotational mixing and element diffusion (e.g. gravitational settling, thermal and chemical diffusion) on the evolution of proto-WDs and on the cooling properties of the resulting WDs. We present state-of-the-art binary stellar evolution models computed with MESA for metallicities of Z = 0.02, 0.01, 0.001 and 0.0002, producing WDs with masses between ∼0.16−0.45 M . Our results confirm that element diffusion plays a significant role in the evolution of proto-WDs that experience hydrogen shell flashes. The occurrence of these flashes produces a clear dichotomy in the cooling timescales of ELM WDs, which has important consequences e.g. for the age determination of binary millisecond pulsars. In addition, we confirm that the threshold mass at which this dichotomy occurs depends on metallicity. Rotational mixing is found to counteract the effect of gravitational settling in the surface layers of young, bloated ELM proto-WDs and therefore plays a key role in determining their surface chemical abundances, i.e. the observed presence of metals in their atmospheres. We predict that these proto-WDs have helium-rich envelopes through a significant part of their lifetime. This is of great importance as helium is a crucial ingredient in the driving of the κ-mechanism suggested for the newly observed ELM proto-WD pulsators. However, we find that the number of hydrogen shell flashes and, as a result, the hydrogen envelope mass at the beginning of the cooling track, are not influenced significantly by rotational mixing. In addition to being dependent on proto-WD mass and metallicity, the hydrogen envelope mass of the newly formed proto-WDs depends on whether or not the donor star experiences a temporary contraction when the H-burning shell crosses the hydrogen discontinuity left behind by the convective envelope. The hydrogen envelope at detachment, although small compared to the total mass of the WD, contains enough angular momentum such that the spin frequency of the resulting WD on the cooling track is well above the orbital frequency.