0
Я пытаюсь минимизировать html-страницу через мой код Java. Для выполнения сжатия используется https://code.google.com/archive/p/htmlcompressor/.Как уменьшить inline css в html с помощью HtmlCompressor?
Вот мой метод для минификация:
public static String minifyHtml(String html) {
HtmlCompressor htmlCompressor = new HtmlCompressor();
htmlCompressor.setRemoveSurroundingSpaces(HtmlCompressor.ALL_TAGS);
htmlCompressor.setPreserveLineBreaks(false);
htmlCompressor.setCompressCss(true);
return htmlCompressor.compress(document.toString());
}
Однако это не преуменьшать на встроенный CSS, что я имею в HTML. Например, для следующего тега:
<div class="content" style="font-family: Helvetica,sans-serif,Lucida Sans Unicode; font-size: 12pt; font-weight: normal; font-style: normal; text-decoration: none; color: rgb(0,0,0); background-color: transparent; margin-top: 0.0pt; margin-bottom: 0.0pt; text-indent: 0.0in; margin-left: 0.0in; margin-right: 0.0in; text-align: left; border-style: none; border-width: 0.0pt; border-color: rgb(0,0,0); padding: 0.0pt; white-space: pre-wrap;">
Может ли это быть минимизированы с помощью HtmlCompressor? Если нет, то есть ли другая библиотека, которая это делает?