...
Preferred way to access resources from a CDN is to put them in a skin.xml file and use the rs:aggregatedResources tag so you get the non-minified versions when desired. The below example assumes
Code Block | ||
---|---|---|
| ||
skin.xml: <resources xmlns="http://www.jasig.org/uportal/web/skin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jasig.org/uportal/web/skin https://source.jasig.org/schemas/resource-server/skin-configuration/skin-configuration-v1.2.xsd"> <js included="plain">//code.jquery.com/jquery-1.10.2.js</js> <js included="aggregated">//code.jquery.com/jquery-1.10.2.min.js</js> <js included="plain">//code.jquery.com/ui/1.10.3/jquery-ui.js</js> <js included="aggregated">//code.jquery.com/ui/1.10.3/jquery-ui.min.js</js> </resources> JSP file: <rs:aggregatedResources path="skin.xml"/> <%-- This example assumes the portlet.xml defines a portlet preference includeJsLibs=false that the installer can override to set to true if needed. --%> <c:if test="${portletPreferencesValues['includeJsLibs'][0] != 'false'}"> <rs:aggregatedResources path="/resources.xml"/> </c:if> <script type="text/javascript"><rs:compressJs> var ${n} = {}; <%-- This is one way to namespace this portlet's version of jQuery --%> <c:choose> <c:when test="${portletPreferencesValues['includeJsLibs'][0] != 'false'}"> ${n}.jQuery = jQuery.noConflict(true) </c:when> <c:otherwise> ${n}.jQuery = up.jQuery; </c:otherwise> </c:choose> ${n}.jQuery(function(){ ... } </rs:compressJs></script> |
The alternative is to load them from the CDNs directly as you would in any webapp.
...