Skip to content

Commit

Permalink
Aggregate the JS and CSS files (we own) that are loaded on every page.
Browse files Browse the repository at this point in the history
  • Loading branch information
mflorea committed Jan 20, 2013
1 parent 9ad91c4 commit a679063
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 11 deletions.
36 changes: 32 additions & 4 deletions xwiki-platform-core/xwiki-platform-web/pom.xml
Expand Up @@ -114,11 +114,39 @@
<!-- Exclude files with complex Velocity code inside -->
<!-- This one iterates over xobjects of type XWiki.SearchSuggestSourceClass -->
<exclude>**/searchSuggest.js</exclude>
<!-- The following stylesheets use the css3_backgroundLinearGradient Velocity macro which expects a map as
parameter and the curly brackets have special meaning in CSS. -->
<exclude>**/modalPopup.css</exclude>
<exclude>**/dashboard.css</exclude>
</excludes>
<aggregations>
<!-- Aggregate the JavaScript code that is loaded on every page. -->
<aggregation>
<insertNewLine>true</insertNewLine>
<inputDir>${project.build.directory}/minimized</inputDir>
<output>${project.build.directory}/minimized/resources/js/xwiki/xwiki-min.js</output>
<includes>
<include>**/xwiki.js</include>
<include>**/entityReference.js</include>
<include>**/modalPopup.js</include>
<include>**/jumpToPage.js</include>
<include>**/confirmationBox.js</include>
<include>**/confirmedAjaxRequest.js</include>
<include>**/notification.js</include>
<include>**/xlist.js</include>
<include>**/suggest.js</include>
</includes>
</aggregation>
<!-- Aggregate the CSS code that is loaded on every page. -->
<aggregation>
<insertNewLine>true</insertNewLine>
<inputDir>${project.build.directory}/minimized</inputDir>
<output>${project.build.directory}/minimized/resources/css/xwiki-min.css</output>
<includes>
<include>**/modalPopup.css</include>
<include>**/jumpToPage.css</include>
<include>**/confirmationBox.css</include>
<include>**/notification.css</include>
<include>**/suggest.css</include>
</includes>
</aggregation>
</aggregations>
</configuration>
</plugin>
</plugins>
Expand Down
Expand Up @@ -44,7 +44,7 @@
#end
#end
/** $notificationType */
.xnotification-$notificationType {
.xnotification-${notificationType} {
background-color: $bgColor;
color: $textColor;
border-color: $textColor;
Expand Down
Expand Up @@ -2,8 +2,12 @@
## JS Libraries.
##
$xwiki.jsfx.use('js/prototype/prototype.js', {'defer': false})
$xwiki.jsfx.use('js/xwiki/xwiki.js', {'forceSkinAction': true, 'defer': false})
$xwiki.jsfx.use('js/scriptaculous/effects.js', true)
$xwiki.jsfx.use('js/xwiki/xwiki-min.js', {'forceSkinAction': true, 'defer': false, 'language': $xcontext.language})
$xwiki.ssfx.use('css/xwiki-min.css', {'forceSkinAction': true, 'colorTheme': $themeDoc, 'language': $xcontext.language})
## The following resources are aggregated by the previous two.
#*
$xwiki.jsfx.use('js/xwiki/xwiki.js', {'forceSkinAction': true, 'defer': false})
$xwiki.jsfx.use('js/xwiki/widgets/modalPopup.js', true)
$xwiki.ssfx.use('js/xwiki/widgets/modalPopup.css', {'forceSkinAction' : true, 'colorTheme' : $themeDoc})
$xwiki.jsfx.use('js/xwiki/widgets/jumpToPage.js', true)
Expand All @@ -17,6 +21,7 @@ $xwiki.ssfx.use('uicomponents/widgets/notification.css', true)
$xwiki.jsfx.use('uicomponents/widgets/list/xlist.js')
$xwiki.jsfx.use('uicomponents/suggest/suggest.js', {'forceSkinAction' : true, 'language' : $xcontext.language})
$xwiki.ssfx.use('uicomponents/suggest/suggest.css', true)
*#
#if($xwiki.exists('XWiki.SearchSuggestConfig'))
## Hook to request the search suggest script if search suggest configuration is present.
## We can't just have it as a always-use SSX yet since we compute a hash to be sure to refresh
Expand All @@ -33,8 +38,8 @@ $xwiki.ssfx.use('uicomponents/suggest/suggest.css', true)
#end
#end
$xwiki.jsfx.use('uicomponents/search/searchSuggest.js', {
'forceSkinAction' : true,
'h' : $searchSuggestConfigHash.hashCode()
'forceSkinAction' : true,
'h' : $searchSuggestConfigHash.hashCode()
})
$xwiki.ssfx.use('uicomponents/search/searchSuggest.css', true)
#end
Expand Down
Expand Up @@ -2375,9 +2375,9 @@ $string##
## Needed for sorting the selected values.
#set ($discard = $xwiki.jsfx.use('js/scriptaculous/dragdrop.js'))
#end
## Needed for displaying a list of suggestions based on the user input.
#set ($discard = $xwiki.ssfx.use('uicomponents/suggest/suggest.css', true))
#set ($discard = $xwiki.jsfx.use('uicomponents/suggest/suggest.js', true))
## Needed for displaying a list of suggestions based on the user input (included by default).
##set ($discard = $xwiki.ssfx.use('uicomponents/suggest/suggest.css', true))
##set ($discard = $xwiki.jsfx.use('uicomponents/suggest/suggest.js', true))
## Needed for managing the selected values. In single selection mode the value selected from the list of suggestions
## overwrites the previously selected value.
#set ($discard = $xwiki.ssfx.use('uicomponents/suggest/suggestPicker.css', true))
Expand Down

5 comments on commit a679063

@vmassol
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. This looks important and it will affect the user, I'd have created a jira issue for it.

@sdumitriu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for an issue and mention in the release notes, it's kind of a backwards compatibility breakage.

@mflorea
Copy link
Member Author

@mflorea mflorea commented on a679063 Mar 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sergiu, can you explain how it can break backwards compatibility? Note that all the aggregated files are still in the war so any extension that was using those files separately should continue to work. Do you have in mind the case when a JavaScript code is loaded (and executed) twice, once from the aggregated file and once separately?

@sdumitriu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a functional backwards compatibility, since by default everything works, but it breaks builds that override such files in a "downstream" distribution (i.e. unzip the XE war, change a file with a patched version, re-zip a new war).

@mflorea
Copy link
Member Author

@mflorea mflorea commented on a679063 Mar 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, thanks.

Please sign in to comment.