How to convert multi-line html code to single-line html code

My test.html code is:

<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> 

conversion to

 <!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html> 

I use manual conversion, please tell me some online converter to convert multi-line HTML to single-line html

+4
source share
7 answers

Try the following:

Minimize HTML (or XHTML), as well as any CSS or JS included in your markup

http://www.willpeavy.com/minifier/

+3
source

Check out a good site

minifier

+2
source

Here is a website that claims to be this.
http://www.odditysoftware.com/page-webtools16.htm

+1
source

Try using StringUtils.chomp

 BufferedReader bufferedReader = new BufferedReader(new FileReader(FILE_NAME)); String s = null; StringBuilder stringBuilder = new StringBuilder(); while((s = bufferedReader.readLine()) != null) { stringBuilder.append(StringUtils.chomp(s)); } System.out.println("stringBuilder : "+stringBuilder); 
+1
source

use http://htmlcompressor.com/compressor/ Click "Show options" and check "Single line html output"

0
source

To do this, you can use any of the following:

http://www.willpeavy.com/minifier/ or http://www.iwebtool.com/html_optimizer

0
source

Source: https://habr.com/ru/post/1498312/


All Articles