Hello!
I've got a serious issue with ResourceLoader.
WHAT FOR it's made to load extension ____styles_____ DYNAMICALLY using JavaScript?!!!!
It's a very bad idea, it leads to page style flickering during load. I.e. first the page is displayed using only skin CSS and then you see how extension styles are dynamically applied to it. Of course it's still rather fast, but it's definitely noticeable, even in Chrome.
Why didn't you just output <link rel="stylesheet" href="load.php?<ALL MODULES>" /> ??????????
Am I free to implement it and submit a patch?????
Why so many question marks? :)
There is OutputPage::addModuleStyles(), it's said that it enables module CSS files via <link /> tags instead of loading it by means of JavaScript. Iirc, it works right like advertised.
On Wed, Jun 5, 2013 at 3:43 PM, vitalif@yourcmc.ru wrote:
Hello!
I've got a serious issue with ResourceLoader.
WHAT FOR it's made to load extension ____styles_____ DYNAMICALLY using JavaScript?!!!!
It's a very bad idea, it leads to page style flickering during load. I.e. first the page is displayed using only skin CSS and then you see how extension styles are dynamically applied to it. Of course it's still rather fast, but it's definitely noticeable, even in Chrome.
Why didn't you just output <link rel="stylesheet" href="load.php?<ALL MODULES>" /> ??????????
Am I free to implement it and submit a patch?????
-- With best regards, Vitaliy Filippov
______________________________**_________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikitech-lhttps://lists.wikimedia.org/mailman/listinfo/wikitech-l
As Paul points out this is how it is supposed to work.
Use $out->addModuleStyles for the most important styles. Any styles that are only used alongside javascript modules should be loaded dynamically and added to the page using $out->addModules.
On Wed, Jun 5, 2013 at 6:05 AM, Paul Selitskas p.selitskas@gmail.com wrote:
Why so many question marks? :)
There is OutputPage::addModuleStyles(), it's said that it enables module CSS files via <link /> tags instead of loading it by means of JavaScript. Iirc, it works right like advertised.
On Wed, Jun 5, 2013 at 3:43 PM, vitalif@yourcmc.ru wrote:
Hello!
I've got a serious issue with ResourceLoader.
WHAT FOR it's made to load extension ____styles_____ DYNAMICALLY using JavaScript?!!!!
It's a very bad idea, it leads to page style flickering during load. I.e. first the page is displayed using only skin CSS and then you see how extension styles are dynamically applied to it. Of course it's still rather fast, but it's definitely noticeable, even in Chrome.
Why didn't you just output <link rel="stylesheet" href="load.php?<ALL MODULES>" /> ??????????
Am I free to implement it and submit a patch?????
-- With best regards, Vitaliy Filippov
______________________________**_________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikitech-lhttps://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- З павагай, Павел Селіцкас/Pavel Selitskas Wizardist @ Wikimedia projects _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- Jon Robson http://jonrobson.me.uk @rakugojon
On Jun 5, 2013, at 2:43 PM, vitalif@yourcmc.ru wrote:
Hello!
I've got a serious issue with ResourceLoader.
WHAT FOR it's made to load extension ____styles_____ DYNAMICALLY using JavaScript?!!!!
It's a very bad idea, it leads to page style flickering during load. I.e. first the page is displayed using only skin CSS and then you see how extension styles are dynamically applied to it. Of course it's still rather fast, but it's definitely noticeable, even in Chrome.
Why didn't you just output <link rel="stylesheet" href="load.php?<ALL MODULES>" /> ??????????
If you need them in the HTML and they are really important, you can use addModuleStyles instead.
However use it sparingly as using that makes it harder to cache things properly, produces slightly more http request overhead.
The client side loader allows all kinds of useful cache features, load optimisations, dependency resolution and rapid global cache puring without requiring a purge of every single page of the wiki. This is what enables Wikipedia to deploy new code in ~ 5 minutes globally without invalidating anything in the HTML.
Historically speaking relying on javascript to load styles may seem odd, but nowadays it is worth it and is in many cases even faster due to being non-blocking (where appropriate).
Loading with javascript also doesn't mean that it will flicker. That only happens if the module is loaded from the bottom. Set 'position' => 'top' in your module and load with addModules() to load it from the top. That should fix the flash of unstyled content.
-- Krinkle
[1] http://www.mediawiki.org/wiki/Manual:$wgResourceModules [2] http://www.mediawiki.org/wiki/ResourceLoader/Features
wikitech-l@lists.wikimedia.org