jsf - 将 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 旁边的正文末尾。如果有,那会是个好主意吗?
谢谢。
解决方案
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.
推荐阅读
- python - 如何在 Python 中获取输入的特定部分以及多段输入
- android - 同步调用中的 Android runOnUiThread()
- c - Visual Studio 无法读取结构的某些成员的内存。
- arrays - 如何创建一个包含 5 个值的数组/切片,所有值都相同
- perforce - Perforce 文件全部删除
- javascript - 发送回函数时如何接收 res.send(req.body)
- javascript - 更改数组中的索引值
- docker - 在另一个容器中以 docker-compose 开头的容器无法访问
- wordpress - wordpress 档案出现在谷歌搜索中
- javascript - document.body.appendChild 和 append(var) 不显示/渲染