简体   繁体   English

干净的html空白和换行

[英]clean html white space and new lines

我如何清理双空格和换行符的html输出,但不使用php修改textarea和pre标签中的内容?

First of all, I would rather say : don't do this : 首先,我想说: 不要这样做

  • There is a risk that you'll introduce errors 您可能会引入错误
  • This is not needed : your cleaned HTML will be rendered the same as the original one 这是不需要的:您清除的 HTML将呈现为与原始HTML相同的形式。
  • You will not gain much on the page's size -- there are many other optimizations that should be done before trying to minify HTML. 您不会在页面大小上获得太多收益-在尝试最小化HTML之前,还需要进行许多其他优化。


Still, if you really want to do that, you are probably looking for an HTML Minifier . 不过,如果您确实想要这样做,则可能正在寻找HTML Minifier

There are several tools that exist, to do that ; 有几种工具可以做到这一点; here are a couple of exemples : 这是几个例子:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM