Page MenuHomePhabricator

Support something similar to a resource template for localBasePath and remoteExtPath duplication in extension.json
Closed, ResolvedPublic

Description

In VisualEditor.php, there is something like:

$wgVisualEditorResourceTemplate = array(
	'localBasePath' => __DIR__,
	'remoteExtPath' => 'VisualEditor',
);

$wgResourceModules += array(
	'jquery.visibleText' => $wgVisualEditorResourceTemplate + array(
		'scripts' => array(
			'lib/ve/lib/jquery/jquery.visibleText.js',
		),
		'targets' => array( 'desktop', 'mobile' ),
	),

Since localBasePath/remoteExtPath are needed by all file modules, this shortens the code. But in extension.json:

[km@km-tp VisualEditor]$ grep "localBasePath" extension.json | wc -l
36
[km@km-tp VisualEditor]$ grep "remoteExtPath" extension.json | wc -l
36

We're just duplicating the same thing over again and making the file even longer than it needs to be.

Event Timeline

Legoktm raised the priority of this task from to High.
Legoktm updated the task description. (Show Details)
Legoktm added a subscriber: Legoktm.
gerritbot added a subscriber: gerritbot.

Change 188996 had a related patch set uploaded (by Legoktm):
registration: Add resource template-like functionality to extension.json

https://gerrit.wikimedia.org/r/188996

Patch-For-Review

Legoktm added a project: MediaWiki-Core-Team.
Legoktm set Security to None.
Legoktm moved this task from Backlog to Needs Review/Feedback on the MediaWiki-Core-Team board.

Change 188996 merged by jenkins-bot:
registration: Add resource template-like functionality to extension.json

https://gerrit.wikimedia.org/r/188996