This project is not covered by Drupal’s security advisory policy.
The aim of the JavaScript Aggregator module is to improve performance of your site with less server requests and bandwidth per page. In Drupal 5, all the JavaScript files will be aggregated into one file and optionally minified. JavaScript aggregation was brought into core with Drupal 6, so the Drupal 6 version of this module goes one step further to minify that file.
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
- Optionally minifies the JavaScript using JSMin
- Returns a modified $scripts variable with link to cached file
To aggregate the JavaScript files in Drupal 5:
- 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
To Minify and Gzip the aggregated file in Drupal 6:
- Enable the module
- Enable the "Optimize and Minify JavaScript" option in admin/settings/performance
Typical Example of performance increase:
FILENAME SIZE DESCRIPTION
6e13ccb6262e06b9f890414db56d3b1f.js 289.558 Bytes > Aggregated by Drupal Core
6e13ccb6262e06b9f890414db56d3b1f.jsmin.js 173.243 Bytes > Minified with JSMin
6e13ccb6262e06b9f890414db56d3b1f.jsmin.js.gz 47.618 Bytes > Minified and gzipped
Development sponsored by: iwanttospeak.net, forward-media.de
Project information
- Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Developer Tools, Performance
- 252 sites report using this module
- Created by derjochenmeyer on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.