diff --git a/min/README.txt b/min/README.txt
new file mode 100644
index 0000000..a57074e
--- /dev/null
+++ b/min/README.txt
@@ -0,0 +1,81 @@
+The files in this directory represent the default Minify setup designed to ease
+integration with your site. Out-of-the-box, Minify can combine and minify files
+and serve them with HTTP compression and cache headers.
+
+
+RECOMMENDED
+
+It's recommended to edit config.php to set $minifyCachePath to a writeable
+directory on your system. This will slightly improve the performance of each
+request.
+
+
+MINIFYING A SINGLE FILE
+
+Let's say you want to serve this file:
+ http://example.com/wp-content/themes/default/default.css
+
+Here's the "Minify URL" for this file:
+ http://example.com/min/?f=wp-content/themes/default/default.css
+
+In other words, the "f" argument is set to the file path from root without the
+initial "/". As CSS files may contain relative URIs, Minify will automatically
+"fix" these by rewriting them as root relative.
+
+
+COMBINING MULTIPLE FILES IN ONE DOWNLOAD
+
+Separate the file paths given to "f" with commas.
+
+Let's say you have CSS files at these URLs:
+ http://example.com/scripts/jquery-1.2.6.js
+ http://example.com/scripts/site.js
+
+You can combine these files through Minify by requesting this URL:
+ http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js
+
+
+SIMPLIFYING URLS WITH A BASE PATH
+
+If you're combining files that share the same ancestor directory, you can use
+the "b" argument to set the base directory for the "f" argument. Do not include
+the leading or trailing "/" characters.
+
+E.g., the following URLs will serve the exact same content:
+ http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js
+ http://example.com/min/?b=scripts&f=jquery-1.2.6.js,site.js
+
+
+USING THESE URLS IN HTML
+
+In (X)HTML files, make sure to replace any "&" characters with "&".
+
+
+
+SPECIFYING ALLOWED DIRECTORIES
+
+By default, Minify will serve any *.css/*.js files within the DOCUMENT_ROOT. If
+you'd prefer to limit Minify's access to certain directories, set the
+$minifyAllowDirs array in config.php. E.g. to limit to the /js and
+/themes/default directories, use:
+
+$minifyAllowDirs = array('//js', '//themes/default');
+
+
+FASTER PERFORMANCE AND SHORTER URLS
+
+For the best performance, edit groupsConfig.php to pre-specify groups of files
+to be combined under different keys. E.g., here's an example configuration in
+groupsConfig.php:
+
+return array(
+ 'js' => array('//js/Class.js', '//js/email.js')
+);
+
+This pre-selects the following files to be combined under the key "js":
+ http://example.com/js/Class.js
+ http://example.com/js/email.js
+
+You can now serve these files with this simple URL:
+ http://example.com/min/?g=js
+
diff --git a/min/config.php b/min/config.php
index c9d631d..58c73c4 100644
--- a/min/config.php
+++ b/min/config.php
@@ -9,33 +9,10 @@
* For best performance, specify your temp directory here.
* Otherwise Minify will have to load extra code to guess.
*/
-$minifyCachePath = 'c:\\xampp\\tmp';
//$minifyCachePath = 'c:\\WINDOWS\Temp';
//$minifyCachePath = '/tmp';
-/**
- * Manually set the path to Minify's lib folder
- */
-//$minifyLibPath = '../lib';
-
-
-/**
- * Set to true to disable the "f" GET parameter for specifying files.
- * Only the "g" parameter will be considered.
- */
-$minifyGroupsOnly = false;
-
-
-/**
- * Allows specification of base directory via the "b" GET parameter.
- * E.g. these are the same:
- * ?f=jsFiles/file1.js,jsFiles/file2.js
- * ?b=jsFiles&f=file1.js,file2.js
- */
-$minifyAllowBase = true;
-
-
/**
* If you'd like to restrict the "f" option to files within/below
* particular directories below DOCUMENT_ROOT, set this here.
@@ -44,4 +21,17 @@ $minifyAllowBase = true;
*
* // = DOCUMENT_ROOT
*/
-$minifyAllowDirs = array('//js', '//css');
+//$minifyAllowDirs = array('//js', '//css');
+
+
+/**
+ * Manually set the path to Minify's lib folder
+ */
+//$minifyLibPath = 'lib';
+
+
+/**
+ * Set to true to disable the "f" GET parameter for specifying files.
+ * Only the "g" parameter will be considered.
+ */
+$minifyGroupsOnly = false;
diff --git a/min/index.php b/min/index.php
index 8a28ef4..d9e3ab0 100644
--- a/min/index.php
+++ b/min/index.php
@@ -33,9 +33,11 @@ if (isset($_GET['g'])) {
// Groups expects the group key as PATH_INFO
// we want to allow ?g=groupKey
$_SERVER['PATH_INFO'] = '/' . $_GET['g'];
- Minify::serve('Groups', array(
- 'groups' => (require MINIFY_MIN_DIR . '/groupsConfig.php')
- ));
+ $serveOpts['groups'] = (require MINIFY_MIN_DIR . '/groupsConfig.php');
+ if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) {
+ $serveOpts['maxAge'] = 31536000;
+ }
+ Minify::serve('Groups', $serveOpts);
} elseif (!$minifyGroupsOnly && isset($_GET['f'])) {
@@ -57,9 +59,7 @@ if (isset($_GET['g'])) {
}
// Version1 already does validation. All we want is to prepend "b"
// to each file if it looks right.
- $base = ($minifyAllowBase
- && isset($_GET['b'])
- && preg_match('@^[^/.]+(?:/[^/.]+)*$@', $_GET['b']))
+ $base = (isset($_GET['b']) && preg_match('@^[^/.]+(?:/[^/.]+)*$@', $_GET['b']))
? '/' . $_GET['b'] . '/'
: '/';
// Version1 expects ?files=/js/file1.js,/js/file2.js,/js/file3.js
diff --git a/min/min_group_uri.php b/min/min_group_uri.php
new file mode 100644
index 0000000..ea9070b
--- /dev/null
+++ b/min/min_group_uri.php
@@ -0,0 +1,31 @@
+
+ *
+ *
+ *
+ *
+ * @param string $group a key of the array in groupsConfig.php
+ * @param string $ampersand '&' or '&' (default '&')
+ * @return string
+ */
+function min_group_uri($group, $ampersand = '&')
+{
+ static $gc = false;
+ if (false === $gc) {
+ $gc = (require dirname(__FILE__) . '/groupsConfig.php');
+ }
+ $b = new Minify_Build($gc[$group]);
+ Minify_Build::$ampersand = $ampersand;
+ return $b->uri('/' . basename(dirname(__FILE__)) . '/?g=' . $group);
+}