???!!! ResourceLoader loading extension CSS DYNAMICALLY?!!

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

???!!! ResourceLoader loading extension CSS DYNAMICALLY?!!

vitalif
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
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: ???!!! ResourceLoader loading extension CSS DYNAMICALLY?!!

Paul Selitskas
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, <[hidden email]> 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
> [hidden email]
> https://lists.wikimedia.org/**mailman/listinfo/wikitech-l<https://lists.wikimedia.org/mailman/listinfo/wikitech-l>




--
З павагай,
Павел Селіцкас/Pavel Selitskas
Wizardist @ Wikimedia projects
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: ???!!! ResourceLoader loading extension CSS DYNAMICALLY?!!

Jon Robson
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 <[hidden email]> 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, <[hidden email]> 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
>> [hidden email]
>> https://lists.wikimedia.org/**mailman/listinfo/wikitech-l<https://lists.wikimedia.org/mailman/listinfo/wikitech-l>
>
>
>
>
> --
> З павагай,
> Павел Селіцкас/Pavel Selitskas
> Wizardist @ Wikimedia projects
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l



--
Jon Robson
http://jonrobson.me.uk
@rakugojon

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: [Wikitech-] ResourceLoader loading extension CSS dynamically?

Krinkle
In reply to this post by vitalif
On Jun 5, 2013, at 2:43 PM, [hidden email] 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 mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: ???!!! ResourceLoader loading extension CSS DYNAMICALLY?!!

vitalif
In reply to this post by vitalif
Hi!

Sorry for not answering via normal Reply, it's because I'm getting
messages in digests.

But I want to say thanks for clarification and for position=top advice
- it's OK with position=top.

Thanks :)

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l