As i understand it, the needs for JSF 2 resources is to help organizing resources directories, and add some versioning and localization.
But is it possible to combin
This is not possible with <h:outputScript>
and <h:outputStylesheet>
yet, as they can only point to webapp's own resources, not to an external URL. This feature has already been requested to the JSF guys. See also JSF spec issue 598. Right now it's scheduled for 2.2, but I don't expect it to be already implemented then as it's currently at 0 votes.
Until then, you'd need to specify them yourself using plain HTML <link>
and <script>
in <h:head>
. You could make it a template definition if necessary, surely when you'd like to define them on a per-view basis.
<h:head>
...
<ui:insert name="resources" />
</h:head>
and
<ui:define name="resources">
<link rel="stylesheet" type="text/css" src="http://.../foo.css" />
<script type="text/javascript" src="http://.../foo.js"></script>
</ui:define>
Update the JSF utility library OmniFaces has since version 1.2 a CDNResourceHandler available which could be used to automatically replace JSF resources by CDN resources when running in production stage. See also the CDNResourceHandler showcase page.