Mailing List Archive

ResourceLoader support coming soon for mobile
I've made a modest initial stab at MobileFrontend support for using
ResourceLoader directly, using a 'target' filtering technique that we
discussed with Trevor, Roan, and Timo. This is another step in integrating
MobileFrontend/SkinMobile into the core MediaWiki ecosystem.

Once we're happy with this and merge it, this'll let both core code and
extensions add appropriate JS and CSS by whitelisting their modules for
mobile -- or including a separate mobile module if necessary -- without
having to special-case JS and CSS loading into MobileFrontend.

Core changes: https://gerrit.wikimedia.org/r/#/c/28433/
MobileFrontend: https://gerrit.wikimedia.org/r/#/c/28434/


In mobile beta mode, if jQuery is listed as supported for the device
profile, instead of loading jQuery directly we load up the ResourceLoader
startup module using the 'mobile' target instead of the default ('desktop').

This filters the module list and dependency graph, including only modules
whitelisted by including 'mobile' in its 'targets' attribute. The startup
module then loads jQuery and the stub 'mediawiki' module for us... as well
as anything that's been specified via OutputPage->addModules(), if it's in
the whitelist.

I haven't yet done much refactoring to make SkinMobile/MobileFrontend use
ResourceLoader fully for its own stuff, except for removing a special case
for the $wgResponsiveImages code that loads high-resolution pictures. By
marking the core JS modules used to implement this with:

'targets' => array( 'desktop', 'mobile' ),

the existing core code that uses OutputPage->addModules() "just works" and
RL loads those modules. Other modules that have not been whitelisted for
mobile don't get included, so we're not randomly loading code that's going
to expect a different environment and just break.

Mobile-specific modules can also specify:

'targets' => 'mobile'

to avoid cluttering up the module list for the desktop, if they're never
going to be used there.


Currently this adds one HTTP request to MobileFrontend output (replacing
one load of jquery with two loads of [RL startup, jquery+mediawiki]), but
we should be able to cut that back down by loading more mobile modules via
RL.


Please feel free to test, give feedback, and/or demand the whole thing be
rewritten (but only with good reason ;).

-- brion
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Re: ResourceLoader support coming soon for mobile [ In reply to ]
On Wed, Oct 17, 2012 at 3:46 PM, Brion Vibber <brion@pobox.com> wrote:

> I've made a modest initial stab at MobileFrontend support for using
> ResourceLoader directly, using a 'target' filtering technique that we
> discussed with Trevor, Roan, and Timo. This is another step in integrating
> MobileFrontend/SkinMobile into the core MediaWiki ecosystem.
>
> Once we're happy with this and merge it, this'll let both core code and
> extensions add appropriate JS and CSS by whitelisting their modules for
> mobile -- or including a separate mobile module if necessary -- without
> having to special-case JS and CSS loading into MobileFrontend.
>
> Core changes: https://gerrit.wikimedia.org/r/#/c/28433/
> MobileFrontend: https://gerrit.wikimedia.org/r/#/c/28434/
>

These have now been merged... yay!

Don't start relying on them until both the core and MobileFrontend sides
have been deployed, just to be sure, but start planning to. :)

-- brion
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l