Reduce HTTP requests with Minify4Joomla
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.
The component com_minify like any #Joomla component
Check proper installation
- Use the menu entry "Check/System", at least the file cache at components/com_minify/cache has to be writable by apache/PHP!
- Activate the URL Builder under "settings"
- Drag and Drop the Bookmarklet tool in your Firefox Bookmark Toolbar
so it look like:
Go to your Joomla frontend
And click on the bookmark tool "Create Minify URL’s", a new tab or pop up will open:
Here for the example I select them all (also add securityimages.js):
- That I have a base Joomla1.5.8 and did not install Joomla in the root directory of my local web server.
- 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.
components/com_securityimages/js/securityImages.js (opens in new window)
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:
To do this, add a line like this to /components/com_minify/groupsConfig.php:
return array( ... your existing groups here ...
‘keyName’ => array(‘//Joomla1.5.8/media/system/js/mootools.js’,
Make sure to replace
keyNamewith a unique key for this group.
In your Joomla! templates /templates/xxxxxxx/index.php
- Add this line in the <head> of your template
or better this one if you did defined a group fjs (frontendjs)
Do the same for all CSS, here it is 6 CSS file for the default templates rhuk_milkyway
<link rel="stylesheet" href="/Joomla1.5.8/components/com_minify/index.php?g=css" />
- 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
when you are sure that you did minify the script caption.js for both front end and back end.
Test proper operations
- Test both your front end and back end!
- Check the cache content
- Switch the URL builder OFF for non obvious security reasons.
My site use it NOW 🙂 but not for all js and css at the moment