In Atom anyway, with Regex enabled, find/replace:
Find: (?=<!--)([\s\S]*?)-->
Replace: ""
Find: \n+
Replace: \n
NB: Blank lines replace presumes "Remove trailing spaces" is enabled. Otherwise, try:
Find: ^(?:[\t ]*(?:\r?\n|\r))+
,
Replace: ""
Of course: https://stackoverflow.com/a/1732454/3189029