Combining javascript using ELGG tools

Last updated by Kitsune Solar

Requirements:

  • ELGG 2.x

 I spied it at www.elgg.org :)

elgg_register_event_handler('init', 'system', 'my_theme_init', 999999);

function my_theme_init()
{
    combine_js();
}

function combine_js()
{
    elgg_unregister_js('jquery');
    elgg_extend_view('elgg.js', 'jquery.js', 1);
    elgg_extend_view('elgg.js', 'shell/js/separator.js', 1);

    elgg_unregister_js('jquery-ui');
    elgg_extend_view('elgg.js', 'jquery-ui.js', 1);
    elgg_extend_view('elgg.js', 'shell/js/separator.js', 1);

    elgg_unregister_js('elgg.require_config');
    elgg_extend_view('elgg.js', 'elgg/require_config.js', 1);
    elgg_extend_view('elgg.js', 'shell/js/separator.js', 1);

    elgg_unregister_js('require');
    elgg_extend_view('elgg.js', 'require.js', 1);
    elgg_extend_view('elgg.js', 'shell/js/separator.js', 1);

    elgg_extend_view('elgg.js', 'shell/js/separator.js');
    elgg_unregister_js('lightbox');
    elgg_extend_view('elgg.js', 'lightbox.js');
}