Thread:Project:Support desk/Ressource Loader advice to style Special:Search (2)

I'm not sure if I'm using the Ressource Loader correctly.

I have 4 KB worth of CSS for my Special:Search. Since it's only used on that page I don't want to add the CSS to MediaWiki:Common.css.

How can I add it to RL via an extension?

That's my setup:

$wgResourceModules['MyExt.onSpecialSearch'] = array( 	'styles' => 'modules/MyExt.onSpecialSearch.css',  	'localBasePath' => __DIR__,  	'remoteExtPath' => '/',  ); // onBeforePageDisplay ... if( $title == "Special:Search" ) { $out->addModules( 'MyExt.onSpecialSearch' ); }

This way my CSS is added as a dynamic style tag in the DOM so my CSS rules only apply after the page is painted already with the default CSS.

That's annoying so maybe I do it wrong.