[Mediawiki-l] Trying to use ResourceLoader...

Daniel Barrett danb at VistaPrint.com
Wed Jul 20 16:36:11 UTC 2011

I am trying to port my extension to use ResourceLoader and I can't seem to make it work. In my .php file I have:

$wgResourceModules['ext.StarRating'] = array
   'scripts' => 'js/starrating.js',
   'styles' => array('css/ui.stars.css',
   'dependencies' => 'jquery.ui.core',
   'localBasePath' => dirname( __FILE__ ),
   'remoteExtPath' => 'StarRatings',
$wgHooks['BeforePageDisplay'][] = 'StarRating::setupDOM';

and in my _body.php file I have:

static function setupDOM(&$out, &$skin) {
       $out->addModules( 'ext.StarRatings' );
       return true;

When I hit the page and View Source, I see:

mediaWiki.loader.load(["mediawiki.util", ........., "ext.StarRatings", ........

so I would think my resource being loaded. But none of the JavaScript & CSS are taking effect on the page. Am I doing something obviously wrong?


More information about the MediaWiki-l mailing list