We are moving our extensions to Joomlashack.com. If you have questions about your membership or need support, please send us a message by clicking this link.

Yoo themes with Warp Framework 6+ have grate option to minify and combine CSS and JavaScript into a single file and use gzip compression and Data URIs to reduce image file requests. But it only works for template files and some Joomla files. In this article you will find tutorial how to make modification in Warp 6+ to compress all CSS and JS files added to Joomla Header.


All changes were made in Yoo Master template with Warp Framework 6.3.1 for Joomla 2.5 and 3.0. It can be also applied to other templates with Warp 6+.

If you have Warp 7+ then read article Compress all CSS and JS with Yoo Warp Framework 7.x.

Head Layout from Warp

Copy file: templates/yoo_master/warp/systems/joomla/layouts/head.php
to newly created: templates/yoo_master/layouts/head.php.

This file is responsible for modifying Joomla head data and compressing CSS and JS files. Edit this file and remove following code (including below part of code) from line 67 - 95 which compress CSS and JS added to Joomla head by some plugins. But at this point component and modules are not rendered yet and did not add any CSS or JS files.

    // compress joomla styles and scripts
    $head = $this['system']->document->getHeadData();

    $this['system']->document->setHeadData(array_merge($head, $data));

Head Layout for Joomla

Create new file: templates/yoo_master/layouts/head_extensions.php with following content which would compress all CSS and JS files from Joomla extensions. We would call this file at the end of template after Joomla extensions are rendered.

// compress styles and scripts
if ($compression = $this['config']->get('compression')) {

    $options = array();
    $filters = array('CSSImportResolver', 'CSSRewriteURL', 'CSSCompressor');

    // set options
    if ($compression == 3) {
        $options['Gzip'] = true;

    // set filter
    if ($compression >= 2 AND ($this['useragent']->browser() != 'msie' OR version_compare($this['useragent']->version(), '8.0', '>='))) {
        $filters[] = 'CSSImageBase64';

    // compress joomla styles and scripts
    $head = $this['system']->document->getHeadData();
    $uri = JURI::getInstance()->toString(array('scheme', 'host'));
    // load Joomla css into Warp
    foreach ($head['styleSheets'] as $style => $meta) {
        if (preg_match('/\.css$/i', $style)) {
            $style = str_replace($uri, '', $style);
            $this['asset']->addFile('jCSS', $style);
    // cache styles and check for remote styles
    $styles = $this['asset']->get('jCSS');
    if ($styles) {
        $styles = array($this['asset']->cache('extensions.css', $styles, $filters, $options));
        foreach ($styles[0] as $style) {
            if ($style->getType() == 'File' && !$style->getPath()) {
                $styles[] = $style;

        foreach ($styles as $style) {
            if ($url = $style->getUrl()) {
                $head['styleSheets'][$url] = array('mime' => 'text/css');

    // load Joomla js into Warp
    foreach ($head['scripts'] as $script => $meta) {
        if (preg_match('/\.js$/i', $script)) {
            $script = str_replace($uri, '', $script);
            $this['asset']->addFile('jJS', $script);

    // cache scripts and check for remote scripts
    $scripts = $this['asset']->get('jJS');
    if ($scripts) {
        $scripts = array($this['asset']->cache('extensions.js', $scripts, array('JSCompressor'), $options));
        foreach ($scripts[0] as $script) {
            if ($script->getType() == 'File' && !$script->getPath()) {
                $scripts[] = $script;
        foreach ($scripts as $script) {
            if ($url = $script->getUrl()) {
                $head['scripts'][$url] = null;

Template Layout

Edit file: templates/yoo_master/layouts/template.php and before closing tag </body> at the end of file add following code which would run code with compression of CSS and JS files from Joomla extensions.

<?php echo $this['template']->render('head_extensions'); ?>


After making all changes go to your template configuration and enable Compression: Combination + Minify + Data URIs + Gzip.

Enable compression

Remember to remove old cache. Go to Site > Maintenance > Clear Cache and select on list template and Delete it.