[xwiki-devs] [proposal] JS and CSS improvements

Ludovic Dubost ludovic at xwiki.org
Wed Mar 12 16:04:22 CET 2008


Yes.. we need this to be able to also create valid XHTML since CSS is 
not allowed in content anyway.
MergeCSS does not work well though. We had to roll it back when we have 
been using it.

Ludovic

Sergiu Dumitriu wrote:
> Hi Ludovic,
>
> Just found this email in my inbox, and was surprised by the similarity 
> with the Skin Extensions proposal.
>
> Ludovic Dubost wrote:
>   
>> Currently the albatross skin loads around 10 js and 10 css, which is 
>> quite a lot.
>> We can improve loading time by:
>>
>> - compression and cache (raffaello will provide Apache configs specific 
>> to XWiki to help for that)
>> - merging and optimizations of css/js (I've published 
>> http://www.xwiki.org/xwiki/bin/view/Code/MergeCSS to help on that)
>> - removing unused css/js (now we need to find which one are unused)
>> - conditional loading of css and js.
>>
>> This last improvement can help us a lot since some of the css/js are not 
>> even used in view mode, or are only used by a specific panel.
>> For this my proposal is to add a feature to the core to allow 
>> conditional loading of CSS and JS files.
>> The current macros in the header would instead of putting CSS and JS add 
>> a placeholder for additional CSS and JS.
>> Then everywhere where we need these CSS/JS (in a panel, in a wiki page, 
>> in a template) we would call a macro #includecss or #includejs
>> This macro would add in the context the CSS and JS to add.
>> At the end of the template rendering the placeholder would be replaced 
>> by the added CSS and JS.
>> The page would be served.
>>
>> This would allow to manage the way CSS and JS are added.
>>
>> WDYT ?
>>
>> Ludovic
>>
>>     
>
>   


-- 
Ludovic Dubost
Blog: http://blog.ludovic.org/
XWiki: http://www.xwiki.com
Skype: ldubost GTalk: ldubost



More information about the devs mailing list