protected void encodeJS(FacesContext context, String library, String script) throws IOException {
        ResourceUtils.addJavascriptResource(context, library, script);
    }
Renders head content based on the following order
- First Facet
- Theme CSS
- PrimeIcons CSS
- Middle Facet
- Registered Resources
- Client Validation Scripts
- Locales
- PF Client Side Settings
- PF Initialization Scripts
- Head Content
- Last Facet
primefaces/src/main/java/org/primefaces/renderkit/HeadRenderer.java