JavaScript Minify HTML Regex

后端 未结 2 418
猫巷女王i
猫巷女王i 2021-01-23 09:29

What would the JavaScript regex be to minify contents of HTML. Note that I only want to remove spaces that are >2 and nothing below.

I also want to replace single quotat

2条回答
  •  我在风中等你
    2021-01-23 10:28

    var s = `
    
        
    foo bar

    baz a
    ` console.log( s.replace(/\s{2,}/g, ' ').replace(/\'/g, '"') )

    should do the job for you

提交回复
热议问题