# When are Lipschitz functions dense in continuous functions?

Let $X$ be a compact metric space, and let $Y$ be another metric space.

I am looking for examples of, and especially references to, theorems that give conditions under which any continuous mapping $f:X\rightarrow Y$ can be arbitrarily well-approximated in the uniform (supremum) distance by Lipschitz mappings $g:X\rightarrow Y$.

If $Y=\mathbb{R}$, then this is answered positively by the Stone-Weierstrass Theorem. (Note that real-valued Lipschitz functions always separate points in a metric space.)

By applying this to the coordinate functions, we get a positive answer as well in the case where $Y=\mathbb{R}^n$ or even some infinite-dimensional Banach spaces like $\ell^p$.

On the other hand, it is easy to come up with pairs of spaces with many continuous maps between them but no non-trivial Lipschitz maps. For example, take $X=[0,1]\subseteq\mathbb{R}$ and $Y=\mathbb{R}$, but where $Y$ is equipped with the metric $$d_Y(p,q) = |p-q|^{1/2}.$$ In this case there are of course many continuous maps from $X$ to $Y$, but every Lipschitz map must be constant.

Are there any references to general theorems that say something positive in the case where, for example, $Y$ is not a Banach space?