I received a question if it is possible to set (or add) a resource via a Theme resource so it will become available to any XPage or Custom control?
Yes ofcourse you can e.g. via:
<resource>
<content-type>text/css</content-type>
<href>custom.css</href>
</resource>
but you should keep in mind is that a Theme is ONLY applied in the Render Response phase. So if for example you include an SSJS library to the Theme, you will not be able to use it in the beforePageLoad or afterPageLoad event. A mistake that is common made.
My recommendation would therefor be to use a Theme more for applying default settings or to overwrite properties to a specific type of component, e.g. a default pageName property on the ViewRoot component.
In terms of adding resources I would advice to use a Custom control design element. SSJS that will be computed dynamically only run once per page load / refresh in a theme (just in Render Response), compared to every phase of the lifecycle in a Custom control.
Happy development =)
Patrick,
I believe you answered my question. I ended up going with the custom control option. Thanks for the input.
Bryan