首页 > 解决方案 > 将 jsf.js 放在正文的末尾

问题描述

我部署了一个 Java EE 8 Web 应用程序。它使用 JSF 2.3 我用 google PageSpeed Insights 对其进行了测试。建议说:

消除渲染阻塞资源

…font/fonts-min.css.xhtml?ln=custom(**.com)
…fullcalendar/fullcalendar.bundle-min.css.xhtml?ln=vendors(**.com)
…base/vendors.bundle-min.css.xhtml?ln=vendors(**.com)
…base/style.bundle-min.css.xhtml?ln=demo(**.com)
…fix/poppins.css.xhtml?ln=custom(**.com)
/javax.faces.resource/jsf.js.xhtml?ln=javax.faces(**.com)

因为 jsf.js 是由 JSF 框架默认添加的。是否有解决方案,以便我将其加载到其他 javascript 旁边的正文末尾。如果有,那会是个好主意吗?

谢谢。

标签: jsfjsf-2jsf-2.2jsf-2.3

解决方案


If you use PrimeFaces, you could activate the "MOVE_SCRIPTS_TO_BOTTOM" feature via context-param.

This moves all script includes (script src="...") to the bottom and it also merges all inline scripts (...) to a single inline script.

This is really a great performance boost.

See: https://github.com/primefaces/primefaces/issues/2888


推荐阅读