How to collectively remove all HTML and CSS comments from a file?



first of all, thank you for creating such an amazing editor!

I am not exactly a coder (certainly not a programmer).

As a marketer in our company though, it is my job to send newsletters to our customers. I coded an HTML template, and numerous HTML (+CSS) comments in it help me immensely.

However, it is not a good idea to keep comments in the final code (SPAM filters may block you). Therefore, I would like to ask you - is there a simple way to remove all the comments from an HTML file?

Ideally, if you could provide a little tutorial on how to bind such a “macro” with a certain keystroke.

Thank you very much :slight_smile:



I did a quick Google search and found this

In Atom you can find for regular expressions .* and use this:


That expression is going to find all the comments and you can replace them with “nothing”.

I hope that helps.


Multi Lang comment removal package would be nice.
Would only need a selector for comment and remove them all.


Since it’s not a package (yet) for Atom, I still use Sublime and its “tag” package if I ever have to do this. I believe BBEdit also offers a “strip all tags” command.


This would be interesting package for atom. I am going to do it when i free. Anyone wanna contribute?