config; // recommend $min_symlinks setting for Apache UserDir $symlinkOption = ''; if (0 === strpos($app->env->server("SERVER_SOFTWARE"), 'Apache/') && preg_match('@^/\\~(\\w+)/@', $app->env->server('REQUEST_URI'), $m) ) { $userDir = DIRECTORY_SEPARATOR . $m[1] . DIRECTORY_SEPARATOR; if (false !== strpos(__FILE__, $userDir)) { $sm = array(); $sm["//~{$m[1]}"] = dirname(__DIR__); $array = str_replace('array (', 'array(', var_export($sm, 1)); $symlinkOption = "\$min_symlinks = $array;"; } } if (!$config->enableBuilder) { header('Content-Type: text/plain'); die('This application is not enabled. See https://github.com/mrclay/minify/blob/master/docs/BuilderApp.wiki.md'); } if ($config->builderPassword && $config->builderPassword !== '') { $auth = new Intervention\Httpauth\Httpauth(array( 'username' => 'admin', 'password' => $config->builderPassword, 'type' => 'digest', 'realm' => 'Minify Builder', )); $auth->secure(); } ob_start(); ?>
Uh Oh. Minify was unable to serve Javascript for this app. To troubleshoot this, enable FirePHP debugging and request the Minify URL directly. Hopefully the FirePHP console will report the cause of the error.
Note: Your webserver does not seem to support mod_rewrite (used in /min/.htaccess). Your Minify URIs will contain "?", which may reduce the benefit of proxy cache servers.
Create a list of Javascript or CSS files (or 1 is fine) you'd like to combine and click [Update].
Place this URI in your HTML to serve the files above combined, minified, compressed and with cache headers.
URI | /min (opens in new window) |
---|---|
HTML |
For the best performance you can serve these files as a pre-defined group with a URI
like: /min/?g=keyName
To do this, add a line like this to /min/groupsConfig.php:
return array(
... your existing groups here ...
);
Make sure to replace keyName
with a unique key for this group.
You can use the bookmarklet below to fetch all CSS & Javascript URIs from a page on your site. When you active it, this page will open in a new window with a list of available URIs to add.
Create Minify URIs (right-click, add to bookmarks)
@import
If your CSS files contain @import
declarations, Minify will not
remove them. Therefore, you will want to remove those that point to files already
in your list, and move any others to the top of the first file in your list
(imports below any styles will be ignored by browsers as invalid).
If you desire, you can use Minify URIs in imports and they will not be touched
by Minify. E.g. @import "/min/?g=css2";
When /min/config.php has $min_allowDebugFlag = true;
you can get debug output by appending &debug
to a Minify URL, or
by sending the cookie minDebug=<match>
, where <match>
should be a string in the Minify URIs you'd like to debug. This bookmarklet will allow you to
set this cookie.
Minify Debug (right-click, add to bookmarks)
Need help? Check the wiki, or post to the discussion list.
Powered by Minify
env, $app->sourceFactory); $minify = $app->minify->serve($controller, array( 'content' => $content, 'id' => __FILE__, 'lastModifiedTime' => max( // regenerate cache if any of these change filemtime(__FILE__), filemtime(__DIR__ . '/../config.php'), filemtime(__DIR__ . '/../lib/Minify.php') ), 'minifyAll' => true, ));