Support

submit a bug report if you need technical support or have questions.

Documentation

Visit the Wiki extensive and up to date documentation at your fingertips.

Contact Me

Missing images/links, any comments, suggestions, need help? Contact me

Joomla extensions have moved!

Galaxiis (formely www.waltercedric.com) creates industry leading premium Joomla Extensions and is the longest running Joomla extensions provider since 2005.

Powerful Joomla extensions. - Excellent documentation. - Amazing support.

Visit now www.galaxiis.com

BETA release

Attention: this kind of mod is intended for developer or Joomla site with high number of visitors and facing performances issues.

A small HOWTO, a more comprehensive documentation can be found in my WIKI. A new forum board has also been started for support, bugs and your comments.

Install

The component com_minify like any Joomla component

Check proper installation

  1. Use the menu entry "Check/System", at least the file cache at components/com_minify/cache has to be writable by apache/PHP!
  2. Activate the URL Builder under "settings"
  3. Drag and Drop the Bookmarklet tool in your Firefox Bookmark Toolbar

minify4joomla.4

so it look like:

minify4joomla.1

Go to your Joomla frontend

And click on the bookmark tool "Create Minify URL's", a new tab or pop up will open:

minify4joomla.2

In A, the tool will present You all JavaScript and CSS it has detected in the page, Remember this may change if you are a public or a registered user, this may also change if you remove or add module and&160; plugin!

Removing JavaScript/CSS HTTP requests

Now in that list, decide which JavaScript files can be combine (most of the time it is all, but you may want to create bundle of them if that is making sense), simply click on the blue link you want to add to the combine list.

Here for the example I select them all (also add securityimages.js):

minify4joomla.3

Note:

  • That I have a base Joomla1.5.8 and did not install Joomla in the root directory of my local web server.
  • You can not mix JavaScript and CSS in one minify URL, this is limitation of HTML tags that are different for JavaScript and CSS.
  • mootools.js and caption.js can be group under the group name jbasejs for example and thus reuse.

Click now the [Update] button, the URL query Builder present you the text below that is self explanatory

Place this URI in your HTML to serve the files above combined, minified, compressed and with cache headers.

URI
/components/com_minify/b=Joomla1.5.8&f=media/system/js/mootools.js,media/system/js/caption.js,
&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; components/com_securityimages/js/securityImages.js (opens in new window)

HTML
<script type="text/javascript" src="/components/com_minify/b=Joomla1.5.8&amp;f=media/system/js/mootools.js,
&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; media/system/js/caption.js,components/com_securityimages/js/securityImages.js"></script>

How to serve these files as a group

For the best performance you can serve these files as a pre-defined group with a URI like: /components/com_minify/g=keyName

To do this, add a line like this to /components/com_minify/groupsConfig.php:

return array(
    ... your existing groups here ...

&160;&160;&160;&160;&160;&160; 'keyName' => array('//Joomla1.5.8/media/system/js/mootools.js',
'//Joomla1.5.8/media/system/js/caption.js',
'//Joomla1.5.8/components/com_securityimages/js/securityImages.js'),
);

Make sure to replace keyName with a unique key for this group.

In your Joomla! templates /templates/xxxxxxx/index.php

  1. Remove all reference to static JavaScript include by first commenting them if you have no backup.
  2. Add this line in the <head> of your template
    <script type="text/javascript" src="/components/com_minify/b=Joomla1.5.8&amp;
    &160; f=media/system/js/mootools.js,media/system/js/caption.js,components/com_securityimages/js/securityImages.js"></script>
    or better this one if you did defined a group fjs (frontendjs)
    <script src="/Joomla1.5.8/components/com_minify/?g=fjs" type="text/javascript"></script>
  3. Remove all dynamically added JavaScript by : see later in article

You did avoid 3 HTTP requests for including JavaScript, and only need one now!

Do the same for all CSS, here it is 6 CSS file for the default templates rhuk_milkyway

  • Remove all reference to static CSS include
  • Add this line in the <head> of your template
    <link rel="stylesheet" href="/Joomla1.5.8/components/com_minify/index.php?g=css" />

    You did avoid 6 HTTP requests for including JavaScript, and only need one now!

    Remove all dynamically added JavaScript

    • This is currently a bit dirty, as Joomla! do not have any hook where com_minify can detect that a Joomla! plugin is trying to&160; insert a new JavaScript or CSS in head of the document. In fact minify would have its place in /libraries ideally.
    • I am trying to find a better/more elegant solution than this one (modifying JResponse), but this one work at the moment.
    • If you start modifying the front end, I highly recommend you to minify also the Joomla back end template.

    Open libraries\joomla\html\html\behavior.php and alter the class JHTMLBehavior

    and comment lines like

    JHTML::script('caption.js');

    when you are sure that you did minify the script caption.js for both front end and&160; back end.

    Test proper operations

    1. Test both your front end and&160; back end!
    2. Using YSLOW or by looking at HTML source code, check that not any other JavaScript or CSS is inserted anymore except by com_minify
    3. Check the cache content
      minify4joomla.check.system
    4. Switch the URL builder OFF for non obvious security reasons.

    &160;

    My site use it NOW :-) but not for all js and css at the moment

  • comments powered by Disqus

    You might like also

    Releasing Minify4Joomla 1.0.0
    This is the version 1.0.0. What does this plugin do? More performances for Joomla! with com_minify It is working as described at Reduce HTTP requests with Minify4Joomla and in my WIKI: http://wiki.waltercedric.com/index.php?title=Com_minify &160; Please use the forum Minify4Joomla Bugtracker&160; for bugs and the WIKI if you find any error in the documentation. Thanks &160;The next version 1.1.0 will have a major new feature: I am currently patching (patch/un-patch through a button) the Joomla! HTML Head Renderer (JDocumentRendererHead) that output the …
    3718 Days ago
    No Thumbnail was found
    Announcement of com_minify I am developing a new component com_minify that will greatly reduce the number of http requests it Combines, minifies, and caches JavaScript and CSS files on demand to speed up page loads. from yahoo performance developer 80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, style sheets, scripts, Flash, etc. Reducing the number of components in turn reduces the …
    3729 Days ago