I'm running with Liferay 6.2 and JSF 2.2.12
I have two custom portlets (using Primefaces).
My portlets import Javascript resources using <h:head />
.
Those portlets are displayed on the same page.
On my staging environment primefaces.js
is included once in the rendered view :
<script src="https://example.com/group/my-site/url?p_p_id=portletone_WAR_portletone&...javax.faces.resource=primefaces.js...">
Why do I get two <script>
in production environment :
<script src="https://example.com/group/my-site/url?p_p_id=portletone_WAR_portletone&...javax.faces.resource=primefaces.js...">
<script src="https://example.com/group/my-site/url?p_p_id=portlettwo_WAR_portlettwo&...javax.faces.resource=primefaces.js...">
(same observation with jquery.js
)
This is due to Liferay Parallel Rendering. In order to disable parallel rendering, add the following property to portal-ext.properties
layout.parallel.render.enable=false
All credit goes to Neil Griffin on the Liferay Forums: https://community.liferay.com/fr/forums/-/message_boards/message/20947470#_com_liferay_message_boards_web_portlet_MBPortlet_message_36195975