Topic on Talk:Snippets

Jump to navigation Jump to search

Make it possible to import the snippets directly

He7d3r (talkcontribs)


I was wondering if wouldn't be better to have the snippets code in real .js pages (e.g. on MediaWiki: namespace, problably as gadgets) so that people could use

mw.loader.load( '//' );

instead of copying the source from Mediawiki pages. The migration guide suggests we should avoid duplication of code.

In case it is necessary to display the source on documentation page, that could be achieved easily by using something like


which results in

mw.loader.load( '//' );

which is the content of MediaWiki:Gadget-HotCat.js.

Krinkle (talkcontribs)

Indeed, but these are small snippets intended as inspiration or examples or so simple that they need no centralization.

The last thing you want is to load all of these as separate http requests for 10 lines of code, that'd be a significant cut in performance.

Stuff that is more advanced or stuff you think should be a gadget, simply make it a gadget and remove the snippet.

He7d3r (talkcontribs)

We should reconsider this, as there are many outdated copies of Snippets copied to WMF wikis' MediaWiki:Common.js pages (or default gadgets).

Reply to "Make it possible to import the snippets directly"