Just found this tool and we are sure it can come in handy for future projects: DirtyMarkup helps you top clean your messy source code.
DirtyMarkup combines the power of HTML Tidy, CSS Tidy, JS Beautify, and the Ace editor to effortlessly clean up your messy code. Just paste your code into the editor and press “clean”. It supports HTML5 too.
So, don’t take my word for it and give it a try (and remember to leave some feedback in the comments pretty please, we really want to know your thoughts): http://dirtymarkup.com/