Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove HTML comments from pages before deployment?

Tags:

At the time of development we tend to put lot of comments in the HTML pages or may be comment out some stuff as per customization request of end user. When dealing with hundreds of pages how to ensure that all commented text is removed before final deployment. Cause packaging pages with comment for everyone else to see ,is I assume a bad practice. So any good tool that can be incorporated in build script to perform these ?

like image 422
calvinscorner Avatar asked Feb 11 '10 12:02

calvinscorner


1 Answers

I use this: Absolute HTML Compressor

It's great and it does NOT change/optimize source code, it does only what you ask it to do. I personally ask it only to remove comments and white spaces at the beginning of each line. From command line or in batch file I do:

ahc "path/file.html" -y- -l- -q- -w+ -t- -c+ -d- -m- -b-

WARNING: -b- option (that I used above) disables backup so the file will be overwritten.

BTW: it has got also a very nice GUI to use it without command line if you want.

like image 179
Marco Demaio Avatar answered Nov 15 '22 06:11

Marco Demaio