Skip to content

Instantly share code, notes, and snippets.

@leodutra
Last active March 1, 2021 04:08
Show Gist options
  • Save leodutra/3790735 to your computer and use it in GitHub Desktop.
Save leodutra/3790735 to your computer and use it in GitHub Desktop.
Remove HTML/JavaScript Comments
function removeComments(html) {
return (''+html)
.replace/*HTMLComments*/(/<!-[\S\s]*?-->/gm, '')
.replace/*JSBlockComments*/(/\/\*[\S\s]*?\*\//gm,'')
.replace/*JSLineComments*/(/^.*?\/\/.*/gm, '$1') // FIXME
}
@boohboohdog
Copy link

kuiloiulio;io;;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment