Skip to content

Instantly share code, notes, and snippets.

@junaidpv
Created August 27, 2011 20:11
Show Gist options
  • Save junaidpv/1175812 to your computer and use it in GitHub Desktop.
Save junaidpv/1175812 to your computer and use it in GitHub Desktop.
Resouce Loader usage sample.
<?php
// Create object
$resouceLoader = ResourceLoader();
// Somewhere in code
$resourceLoader->add( array (
'jquery' => array(
'styles' => 'css/themename/jquery-ui-1.8.16.custom.css',
'scripts' => array( 'js/jquery-1.4.4.min.js', 'js/jquery-ui-1.8.16.custom.min.js'),
),
) );
// Again, somewhere
$resourceLoader->add( array (
'ourcode' => array(
'styles' => 'css/some-css.css',
'scripts' => 'js/some-js-that-depend-on-jquery.js',
'dependencies' => 'jquery',
),
) );
// Finally, in template/theme
echo $resouceLoader->render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment