我试图使用HTML压缩机标签库中的Maven https://mvnrepository.com/artifact/com.googlecode.htmlcompressor/htmlcompressor/1.4HTML缩小6.0
使用HTML缩小我添加了下面的依赖关系的pom.xml
<dependency>
<groupId>com.googlecode.htmlcompressor</groupId>
<artifactId>htmlcompressor</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.yahoo.platform.yui</groupId>
<artifactId>yuicompressor</artifactId>
<version>2.4.6</version>
</dependency>
下面是我的header.jsp
<%@include file="/apps/itchotelsonline/components/global.jsp"%>
<%@page import ="com.itc.hotels.services.ItcOnlineConfigurationService" %>
<%@ taglib uri="http://htmlcompressor.googlecode.com/taglib/compressor"
prefix="compress"%>
<%
ItcOnlineConfigurationService onlineConfigService = sling.getService(com.itc.hotels.services.ItcOnlineConfigurationService.class);
if(onlineConfigService != null){
String rootPagePath = onlineConfigService.getRootPagePath();
slingRequest.setAttribute("rootPagePath",rootPagePath);
}
%>
<compress:html removeIntertagSpaces="true" enabled="true" removeComments="false" compressJavaScript="true" yuiJsDisableOptimizations="true">
<cq:include path="${rootPagePath}/jcr:content/header" resourceType="itchotelsonline/components/content/header"/>
<div class="modal fade in new-modal" id="loginOverlayPopup" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-body text-center">
<center>
<p><strong id="loginInactivityPopUp"> You are Logged Out due to Inactivity! </strong></p>
</center>
<div class="clear"></div>
<div class="newBook clearfix">
<button type="button" class="btn btn-default" id="loginInactivityBtn" data-dismiss="modal" onclick="resetLoginInactivityPopUp();">Close</button>
</div>
</div>
</div>
</div>
</div>
其中我加了compress html行和taglibs。
<%@ taglib uri="http://htmlcompressor.googlecode.com/taglib/compressor"
prefix="compress"%>
<compress:html removeIntertagSpaces="true" enabled="true" removeComments="false" compressJavaScript="true" yuiJsDisableOptimizations="true">
下面是我的footer.jsp中
<%@include file="/apps/itchotelsonline/components/global.jsp"%>
<%@page import ="com.itc.hotels.services.ItcOnlineConfigurationService" %>
<%
ItcOnlineConfigurationService onlineConfigService = sling.getService(com.itc.hotels.services.ItcOnlineConfigurationService.class);
if(onlineConfigService != null){
String rootPagePath = onlineConfigService.getRootPagePath();
pageContext.setAttribute("rootPagePath",rootPagePath);
}
%>
<cq:include path="${rootPagePath}/jcr:content/footer" resourceType="itchotelsonline/components/content/footer"/>
</compress:html>
我结束了在此。绝对URI:
给Maven构建全新安装我收到以下错误
org.apache.sling.scripting.jsp.jasper.JasperException后http://htmlcompressor.googlecode.com/taglib/compressor不能在在web.xml或罐子解决在org.apache.sling.scripting.jsp.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)部署该应用 文件
我试图重新启动AEM实例,并刷新束但是这并没有解决这个问题。 我想在我的AEM网站上实现HTML缩小。我已经检查了一天CQ HTML库管理器,但它只压缩CSS和JS,而不是通过AEM中的JSP呈现的HTML。 AEM中是否有替代方法可以使用,或者可以使用html压缩器而不会出现上述错误? 请提前建议并提前致谢。
****新的编辑******
我进口图书馆作为OSGi包,但现在它扔了一个类型转换exception.I发现htmlcompressor未压缩的JSP,但是需要纯HTML进行压缩,页面速度mod是一种可能的选择,但CSS和JS已经被Day CQ HTML Library Manager缩小了,并且我们还通过更改httpd.conf中的缓存配置来利用浏览器缓存。我唯一的要求是HTML缩小。是否有任何库可以与AEM集成并用于相同的?
我尝试使用OSGI包,但该库似乎无法与JSP一起使用。你能否建议一个可以与AEM一起使用的替代库,用于HTML缩小,并且可以与JSP一起使用,而不仅仅是HTML?我正在研究granule https://github.com/JonathanWalsh/Granule,但是如何将它集成到AEM ? –
@AdityaAuradkar对不起,我不知道图书馆会这样做,我不知道你为什么想。将代码库重构为Sightly模板时会发生什么?仅供参考,你可以配置mod_pagespeed只删除空白,如果你愿意。 – mickleroy