This work provides an optimisation mechanism to ensure the compatibility of non-planar stellarator coils with ReBCO (rare-earth barium copper oxide) high-temperature superconducting (HTS) tape. ReBCO coils enable higher field strengths and/or operating temperatures for the magnet systems of future fusion reactors, but they are sensitive to mechanical strain due to their brittle, ceramic functional layer. To ensure that non-planar coils can be wound without damage, we have introduced into the stellarator optimisation framework SIMSOPT a penalty on the binormal curvature and torsion of the tape. This metric can be used to optimise the tape winding orientation along a given coil filament or the coil filament itself can also be free to vary as part of the strain optimisation. We demonstrate the strain optimisation in three examples. For the EPOS (electrons and positrons in an optimised stellarator) design, we combined the strain penalty with an objective for quasisymmetry into a single-stage optimisation; this enables us to find a configuration with excellent quasisymmetry at the smallest possible size compatible with the use of ReBCO tape. For CSX (Columbia stellarator experiment), in addition to HTS strain, we added a penalty to prevent full turn tape rotation, so as to ease the coil winding process. For a coil at reactor scale, we found a considerable variation of the binormal and torsional strain over the cross-section of the large winding pack (54 cm x 54 cm); by exploiting the overall orientation of the winding pack as a degree of freedom, we were able to reduce strains below limits for all of the ReBCO stacks in the pack.