Suppose that $X$ is a paracompact Hausdorff space (e.g. a metric space) with $\dim X=n$ (the Lebesgue covering dimension). I want to find a proof (or a reference) that any (continuous) map $f: X \to K(\mathbb{Z},2)=\mathbb{C}P^\infty$ can be factorized, up homotopy, thorough a CW-complex $Z$ of the same dimension $n$, i.e. there is a diagram
which commutes, up to homotopy.