In this paper, we formulate and prove a general compactness theorem for harmonic maps of Riemann surfaces using Deligne-Mumford moduli space and families of curves. The main theorem shows that given a sequence of harmonic maps over a sequence of complex curves, there is a family of curves and a subsequence such that both the domains and the maps converge with the singular set consisting of only "non-regular" nodes. This provides a sufficient condition for a neck having zero energy and zero length. As a corollary, the following known fact can be proved: If all domains are diffeomorphic to S-2, both energy identity and zero distance bubbling hold.