--- javascript_aggregator.module +++ javascript_aggregator.module @@ -28,6 +28,13 @@ '#default_value' => variable_get('javascript_aggregator_gzip', FALSE), '#weight' => 2, ); + $form['bandwidth_optimizations']['javascript_aggregator_jsminplus'] = array( + '#type' => 'checkbox', + '#title' => t('Use JSMin+ instead of JSMin'), + '#description' => t('Check this option to use JSMin+ instead.', array('@jsminplus' => 'http://crisp.tweakblogs.net/blog/1665/a-new-javascript-minifier-jsmin+.html')), + '#default_value' => variable_get('javascript_aggregator_jsminplus', FALSE), + '#weight' => 3, + ); } } @@ -113,9 +120,17 @@ // Create the JSMinified file if it doesn't exist yet. if (!file_exists($jsmin_file_path)) { - // JSMin the contents of the aggregated file. - require_once(drupal_get_path('module', 'javascript_aggregator') .'/jsmin.php'); - $contents = JSMin::minify(file_get_contents(file_directory_path() . $aggregated_file)); + if (variable_get('javascript_aggregator_jsminplus', FALSE)) { + // JSMin+ the contents of the aggregated file. + require_once(drupal_get_path('module', 'javascript_aggregator') .'/jsminplus.php'); + $contents = JSMinPlus::minify(file_get_contents(file_directory_path() . $aggregated_file)); + } + else { + // JSMin the contents of the aggregated file. + require_once(drupal_get_path('module', 'javascript_aggregator') .'/jsmin.php'); + $contents = JSMin::minify(file_get_contents(file_directory_path() . $aggregated_file)); + } + if (variable_get('javascript_aggregator_gzip', FALSE)) { // Create the GZip file if it doesn't already exist.