Roan Kattouw wrote:
2010/9/6 Platonides <Platonides(a)gmail.com>om>:
Gadgets should be minifiable, too.
Should
be a matter of porting the Gadgets extension. Will need a bit
of smartness because gadgets are wiki pages rather than files, but
it's definitely doable.
Perhaps having an update add an standalone flag
to the gadgets
definitions, and minify everything without it.
You mean something like a permanent
debug or compatibility mode for
selected gadgets?
Yes. If Common.js has issues for minimifying, gadgets could as well. I
first thought at it as "legacy", but there might be some reason for
wanting it loaded separately. As far as not providing any flag,
minifyies it, that shouldn't be a problem.
It would also
be nice to be able to specify a filter there on which the
is run (Special:Upload, namespace 2...)
That's actually something you can do with a custom loader script. This
allows you to write the code calling mediaWiki.loader.register()
yourself rather than having it generated by the resource loader
(default), and to dynamically generate dependency information on the
fly (by putting your dependency generation code in a closure that's
only run when the module's dependency information is needed). At the
point that script is run you don't have access to environment
variables like the title and namespace yet, but the dependency
registration closure does, so you can hack around it by adding an
empty module that either does or doesn't depend on a second module
with the actual code (eww, maybe we should add better support for
this; typically this would be checked on the server side before adding
the module or on the client side before requesting the module, though,
but Gadgets can't do that easily).
Maybe adding a gadget module which in turns loads the others as needed?
I'm not familiar with the resource loaded code to determine the best way
to design it.
Unfortunately, I don't think these loader scripts
currently allow you
to override some but not all parts of the registration call, it's
either all or nothing. This is particularly annoying since the last
modified timestamp of a module is hard to obtain on the client side.
Filed this as
https://bugzilla.wikimedia.org/show_bug.cgi?id=25085 .
Roan Kattouw (Catrope)
And I don't understand what this last paragraph is about :) You are
trying to reuse the same loader for all gadgets?