Home > front end >  How do I use js code to compress HTML/js code, remove the blank line
How do I use js code to compress HTML/js code, remove the blank line

Time:09-22

Excuse me how js compressed compressed HTML/js code, remove the blank line or something, such as http://www.lccee.com/htmlgeshihua/normal pressure, but does not destroy the original js and HTML code,,

The ABOUT US



The geographical position is superior, the transportation is convenient, facilitate outbound flowers, we perennial supply of various seasonal brews, perennial root flowers, green seedlings, flower shrubs, trees, aquatic plants, high middle-grade flowers, all kinds of potted flower, pin flower series and so on, for all enterprises and institutions, hotels, hotel provide flowers, bonsai, rent pendulum business, & lt;/p>





CodePudding user response:

This plugin one to grasp a large online

CodePudding user response:

Use the string replaced can replace

 let STR=` 

The ABOUT US



The geographical position is superior, the transportation is convenient, facilitate outbound flowers, we perennial supply of various seasonal brews, perennial root flowers, green seedlings, flower shrubs, trees, aquatic plants, high middle-grade flowers, all kinds of potted flower, pin flower series and so on, for all enterprises and institutions, hotels, hotel provide flowers, bonsai, rent pendulum business, & lt;/p>





`
Let str2=STR. Replace (\ n/g, "). The trim ()//remove the newline tail and head space
Let replacer=function (match, p1, p2, p3, offset) {
Return p1 + p3
}
Let str3=str2. Replace (/(& gt;) (\ s *) (& lt;)/g, replacer)//& gt; And & lt; The space between to remove
The console. The log (str3)
//& lt; Div & gt;
The ABOUT US
The geographical position is superior, the transportation is convenient, facilitate outbound flowers, we perennial supply of various seasonal brews, perennial root flowers, green seedlings, flower shrubs, trees, aquatic plants, high middle-grade flowers, all kinds of potted flower, pin flower series and so on, for all enterprises and institutions, hotels, hotel provide flowers, bonsai, rent pendulum business, & lt;/p>

CodePudding user response:

Don't know what requirements, common compression can use webpack, glup etc to do
  • Related