The title sounds tautological, right? Perhaps I'm missing something completely trivial here ...

Assume $X$ is a compact totally disconnected hausdorff space. It is known that $X$ can be written as directed inverse limit of finite discrete spaces $X_i$ with surjective transition maps (i.e. $X$ is profinite). How do you prove that every map from $X$ to a finite discrete space factors through some projection $X \to X_i$?

I know that the fibers of the projections are a basis of the topology of $X$ (not only a subbasis). The corresponding result for profinite groups is true, but I cannot adopt the proof.

Of course you could use Stone duality to reduce the assertions to a completely trivial one (a finite boolean ring in a directed limit of boolean subrings lies in some of these boolean subrings), but I want a direct topological proof.