Wicket9:如何在发送给用户之前压缩(最小化)HTML?
Wicket9: How to compress (minimize) HTML before sending to user?
我知道如何在发送给客户端之前压缩 JavaScript 和 CSS 资源
使用
getResourceSettings().setCssCompressor(new MyCssCompressor());
getResourceSettings().setJavaScriptCompressor(
new MyJavaScriptCompressor);
是否有与 HTML 标记类似的内容?
中有一个 HTML Compressor 库
用法如下:
public class HtmlCompressorApp extends AbstractApp {
@Override
protected void init() {
super.init();
if (usesDeploymentConfig()) {
getMarkupSettings().setMarkupFactory(new HtmlCompressingMarkupFactory());
// if we want custom settings for our compressor we could do this instead:
// HtmlCompressor compressor = new HtmlCompressor();
// compressor.setPreserveLineBreaks(true);
// getMarkupSettings().setMarkupFactory(new HtmlCompressingMarkupFactory(compressor));
}
}
}
Maven 坐标:org.wicketstuff:wicketstuff-htmlcompressor:9.4.0
我知道如何在发送给客户端之前压缩 JavaScript 和 CSS 资源
使用
getResourceSettings().setCssCompressor(new MyCssCompressor());
getResourceSettings().setJavaScriptCompressor(
new MyJavaScriptCompressor);
是否有与 HTML 标记类似的内容?
用法如下:
public class HtmlCompressorApp extends AbstractApp {
@Override
protected void init() {
super.init();
if (usesDeploymentConfig()) {
getMarkupSettings().setMarkupFactory(new HtmlCompressingMarkupFactory());
// if we want custom settings for our compressor we could do this instead:
// HtmlCompressor compressor = new HtmlCompressor();
// compressor.setPreserveLineBreaks(true);
// getMarkupSettings().setMarkupFactory(new HtmlCompressingMarkupFactory(compressor));
}
}
}
Maven 坐标:org.wicketstuff:wicketstuff-htmlcompressor:9.4.0