joomlajoomla3.0

How do I stop Joomla from including jQuery?


I've recently upgraded from Joomla 3.2.1 to Joomla 3.2.2.

In Joomla 3.2.1, I manually unset jQuery from being included:

$doc = JFactory::getDocument();

$dontInclude = array(
'/media/jui/js/jquery.js',
'/media/jui/js/jquery.min.js',
'/media/jui/js/jquery-noconflict.js',
'/media/jui/js/jquery-migrate.js',
'/media/jui/js/jquery-migrate.min.js',
'/media/jui/js/bootstrap.js',
'/media/system/js/core-uncompressed.js',
'/media/system/js/tabs-state.js',
'/media/system/js/core.js',
'/media/system/js/mootools-core.js',
'/media/system/js/mootools-core-uncompressed.js',
);
foreach($doc->_scripts as $key => $script){
    if(in_array($key, $dontInclude)){
        unset($doc->_scripts[$key]);
    }
}

But this isn't working in Joomla 3.2.2. Is there a way to not include Joomla's jQuery in 3.2.2?


Solution

  • I've added:

                $doNotInclude = array(
                    'jquery',
                    'bootstrap',
                    'behavior',
                );
                if(in_array($file, $doNotInclude)){
                    return;
                }
    

    immediately after:

                list($key, $prefix, $file, $func) = static::extract($key); 
    

    in libraries/cms/html/html.php, in the "_" function.

    I don't like it since its a modification to the Joomla core but it works. I'm still looking for a better solution.