Introduction

Each component defines its dependencies on JavaScript / CSS resources and JSF makes sure the links for loading these resources are included in the page when the component is rendered.

When using resource libraries the way component libraries like RichFaces does, a lot of resource links are generated to the page, leading to many requests to obtain these resources for first-time visitors (when resources are not yet cached), which can be a real performance problem.

A second problem is brought upon by RichFaces itself, since some of resources (ECSS, generated images) are generated in runtime, which can be problematic in certain runtime environments (ie. Google App Engine). Without intervention, RichFaces would be unable to work in such environments.

That's why RichFaces can pre-process resources at build time and that's what you can achieve with custom resources too.

Generating customized set of resources

But in some cases, it's desired to generate custom set of resources:

you want to pack jsf.js (JavaScript part of JSF implemention) with rest of component resources

you are using custom components

By default, RichFaces does not know about specific JSF implementation used in your project, that's why jsf.js resource is not packed in RichFaces Components bundle. To further optimize resource loading, it's possible to pack jsf.js in your target application, to optimize resource loading to maximum level.

Second basic usage of generating customized set of resources is when you are using custom components and you want their resources to be processed.

Goals of the RichFaces CDK: Resources Maven Plugin

Static equivalents ensures that dynamic resources are generated in build time and thus no runtime restrictions are applied to these resources and it also gives performance improvement over dynamic generation and caching in runtime.