Combining redactor plugins into a single, compressed file
authorAlexander Ebert <ebert@woltlab.com>
Thu, 17 Apr 2014 14:03:32 +0000 (16:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 17 Apr 2014 14:03:32 +0000 (16:03 +0200)
Right now there are 8 plugins so far, this would normally cause 8 HTTP requests just to fetch them or check if the cached file is still up-to-date. Since it does not matter in which order these plugins are fetched (the editor executes them at a later point in the correct order), we can safely combine them into a single, compressed file. This saves us 7 requests. Glorious!

com.woltlab.wcf/templates/wysiwyg.tpl

index c721a908b8c32a6901e4ba091e4ea7521ee3c64a..84705c8af2f32ea61ec73f3e0f3bfb3e54d0a15d 100644 (file)
@@ -74,15 +74,19 @@ $(function() {
        
        head.load([
                '{@$__wcf->getPath()}js/WCF.Attachment{if !ENABLE_DEBUG_MODE}.min{/if}.js?v={@$__wcfVersion}',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/redactor.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wbbcode.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wbutton.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wfontcolor.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wfontfamily.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wfontsize.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wmonkeypatch.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wutil.js',
-               '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wupload.js'
+               '{@$__wcf->getPath()}js/3rdParty/redactor/redactor{if !ENABLE_DEBUG_MODE}.min{/if}.js?v={@$__wcfVersion}',
+               {if !ENABLE_DEBUG_MODE}
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wcombined.min.js?v={@$__wcfVersion}',
+               {else}
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wbbcode.js?v={@$__wcfVersion}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wbutton.js?v={@$__wcfVersion}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wfontcolor.js?v={@$__wcfVersion}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wfontfamily.js?v={@$__wcfVersion}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wfontsize.js?v={@$__wcfVersion}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wmonkeypatch.js?v={@$__wcfVersion}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wutil.js?v={@$__wcfVersion}',
+                       '{@$__wcf->getPath()}js/3rdParty/redactor/plugins/wupload.js?v={@$__wcfVersion}'
+               {/if}
                {event name='javascriptFiles'}
        ], function() {
                WCF.System.Dependency.Manager.invoke($callbackIdentifier);