我在我的一个 Liferay portlet 中使用了多个 css 和 js 文件。 liferay-portlet.xml 文件中包含的 CSS 和 JS 文件会自动包含在页面中。
除了 XML 文件中提到的文件外,我还使用了使用链接和脚本标记的外部 CSS 和 JS 文件。
如何缩小这些文件?
或
<portlet>
<portlet-name>demo-page</portlet-name>
<icon>/icon.png</icon>
<header-portlet-css>/css/main.css</header-portlet-css>
<header-portlet-css>/css/style.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
</portlet>
我想在 page1.jsp 中使用 main.css 而不是在 page2.jsp 中。 我可以为 liferay-portlet.xml 中包含的文件定义页面范围吗?
最佳答案
您只需像使用 css 一样使用您的文件:< link rel="stylesheet" href="<%=request.getContextPath()%>/my_sources/css/style.css"/>
liferay 负责缩小(除非您在 portal-ext.properties 中禁用了它)。
关于javascript - Liferay:如何缩小 jsp 中包含的 CSS 和 JS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37344151/