|
|
|
Conditional example:
<skin> 0 javascript files, 2 stylesheets. The 2nd stylesheet is included in an Internet Explorer conditional comment. portal.properties should contain the property for configuring "developer" or "production" modes described above.
skin.xml file that would live in the skin directory:
<?xml version="1.0" encoding="UTF-8"?> <resources> <!-- base Fluid Skinning System --> <css>../common/css/fluid/fluid.reset.css</css> <css>../common/css/fluid/fluid.layout.css</css> <css>../common/css/fluid/fluid.text.css</css> <!-- For printing of portal pages. Common to all skins using the universality theme --> <css>../common/css/print.css</css> <!-- For layout of portal pages (in tandem with FSS fluid.layout.css). Common to all skins using the universality theme. --> <css>../common/css/layout.css</css> <!-- Support for legacy uPortal css classes. --> <css>uportal3_legacy.css</css> <!-- Default jqueryui css --> <css>/ResourceServingWebapp/rs/jqueryui/1.6rc6/theme/smoothness/ui.all.css</css> <!-- uPortal jqueryui override css --> <css>jquery.css</css> <!-- Visual style for the portal. Built and formatted as a Fluid Skinning System theme. --> <css>fluid.theme.uportal3.css</css> <!-- Visual style for portlet content. An extension of the uportal3 skin. --> <css>uportal3_portlet.css</css> <css>jsr168_portlet_spec.css</css> <!-- Overrides specific to IE6. --> <css conditional="if IE 6">uportal3_ie6override.css</css> <js>../common/javascript/uportal/ajax-preferences-jquery.js</js> <js>../common/javascript/uportal/up-channel-browser.js</js> <js>../common/javascript/uportal/up-group-browser.js</js> <js>../common/javascript/uportal/flyout-nav.js</js> </resources> Directory structure for the corresponding skin and shared files: uportal-war/src/main/webapp/media/skins/universality
|-- common
| |-- css
| | |-- fluid
| | | |-- fluid.layout.css
| | | |-- fluid.reset.css
| | | `-- fluid.text.css
| | |-- layout.css
| | `-- print.css
| `-- javascript
| `-- uportal
| |-- ajax-preferences-jquery.js
| |-- flyout-nav.js
| |-- up-channel-browser.js
| `-- up-group-browser.js
|-- skinList.xml
|-- universality_full.gif
|-- universality_icon.gif
`-- uportal3
|-- fluid.theme.uportal3.css
|-- jquery.css
|-- jsr168_portlet_spec.css
|-- skin.xml
|-- uportal3_ie6override.css
|-- uportal3_legacy.css
`-- uportal3_portlet.css
After running through the plugin the following skin.aggr.xml would exist: <?xml version="1.0" encoding="UTF-8"?> <resources> <!-- | AGGREGATE OF: | ../common/css/fluid/fluid.reset.css | ../common/css/fluid/fluid.layout.css | ../common/css/fluid/fluid.text.css +--> <css>../common/css/fluid/uportal3_aggr1_MD5GOESHERE.css</css> <!-- | AGGREGATE OF: | ../common/css/print.css | ../common/css/layout.css +--> <css>../common/css/uportal3_aggr2_MD5GOESHERE.css</css> <!-- | AGGREGATE OF: | uportal3_legacy.css +--> <css>uportal3_aggr3_MD5GOESHERE.css</css> <!-- | AGGREGATION BREAK: | external resource, causes break in aggregation to maintain ordering +--> <css>/ResourceServingWebapp/rs/jqueryui/1.6rc6/theme/smoothness/ui.all.css</css> <!-- | AGGREGATE OF: | jquery.css | fluid.theme.uportal3.css | uportal3_portlet.css | jsr168_portlet_spec.css +--> <css>../common/css/uportal3_aggr4_MD5GOESHERE.css</css> <!-- | AGGREGATE OF: (break in aggregation due to change in conditional from previous <css> element) | uportal3_ie6override.css +--> <css conditional="if IE 6">uportal3_aggr5_MD5GOESHERE.css</css> <!-- | AGGREGATE OF: | ../common/javascript/uportal/ajax-preferences-jquery.js | ../common/javascript/uportal/up-channel-browser.js | ../common/javascript/uportal/up-group-browser.js | ../common/javascript/uportal/flyout-nav.js +--> <js>../common/javascript/uportal/uportal3_aggr1_MD5GOESHERE.js</js> </resources> Another note, the above example uses the following format for the aggregate file name: skin_aggrN_MD5.type
Where skin is the name of the skin the resource definition XML file is for, aggrN is an incrementing value to make tracking aggregate order easier, MD5 is the MD5 hash of the file's contents and type is the file type css or js. Another idea for the developer/prod toggle would be to use a JVM property instead of an entry in portal.properties. That would let the setting be toggled without redeploying uPortal.
Committed initial implementation on trunk of sandbox/maven-uportal-plugin project, includes:
Outstanding work yet:
maven-uportal-plugin currently depends on YUI Compressor version 2.3.6 (the only version available via maven), however that version is broken.
There is a new release of YUI Compressor available - 2.4.2 - we will need to install this jar in the 3rd party repository. Mojo has been tested successfully as part of the uPortal build. Committed a copy of the resources/js/css object model in uPortal/trunk, along with a Xalan extension implementation that can convert the resources into the appropriate script and link HTML tags. Outstanding work:
Almost done! Resolution of skin.xml and the css/js it refers to is now complete.
I have an update to the StaticRenderingPipeline and universality's page.xsl that does in fact accomplish the goals of this task (it works!), however I have to hold off on checking it in until we: 1. resolve the YUI Compressor issue mentioned in the prior comment Checking these last 2 modifications in before resolving the above would temporarily break trunk. YUICompressor issues resolved (required exclusion of Mozilla Rhino, as author includes own modified version of Rhino in yui compressor distribution).
uPortal trunk now has working implementation, depends on release 1.0.0-M2 of maven-uportal-plugin to aggregate during uportal-war build. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<skin>
<javascript>path/to/javascript1.js</javascript>
<css>path/to/stylesheet.css</css>
</skin>
This skin has 1 javascript file and 1 stylesheet. Note that the paths do not start with "/" characters; this denotes these files are relative to the web context (e.g. /uPortal/path/to/javascript.js).