Javascript Aggregator
derjochenmeyer - January 17, 2008 - 01:07
This module adds a simple .js aggregation to Drupal 5.x.
It increases the performance of your site with less server requests per pageload. Especially in shared hosting environments this can be a huge boost.
This approach requires NO core-patching.
To fix problems with some modules like TinyMCE edit the discard list at admin/settings/performance
It basically does the following:
- takes the $scripts variable and removes .js files using a regular expression
- generates a unique filename for any set of .js files
- creates and caches one file containing all .js files in files/js
- returns a modified $srcipts variable with link to cached file
To aggregate .js files
- enable the module
- go to admin/settings/performance and enable the js cache (you'll also find an option to clear js cache)
- place the following code inside your page.tpl.php file just before
<?php print $scripts; ?>
<?php
if(module_exists('javascript_aggregator')) {
$scripts = javascript_aggregator_cache($scripts);
}
?>Its not good practice however to place php code in your tpl.php files. If you are more familiar with drupal, USE THIS WAY TO CALL THE FUNCTION:
http://drupal.org/node/218870#comment-721082
Comments welcome.
Developement sponored by: http://iwanttospeak.net
Releases
| Official releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 5.x-1.3 | 2008-Apr-19 | 8.89 KB | Download · Release notes | Recommended for 5.x | |
