My favorites | Sign in
Logo
                
Search
for
Updated Oct 30, 2009 by st...@mrclay.org
Labels: Phase-Deploy, Featured
UserGuide  
Your friendly guide to installing and using Minify.

If this page doesn't help, please post a question on our Google group.

Installing Minify for the first time

Download the latest Minify and unzip the files to a new "minify" directory.

Copy the "min" folder directly into your DOCUMENT_ROOT.

Done!

(Optional) See TestingMinify if you'd like to run unit tests.

Upgrading Minify from 2.1.x

See the Upgrade Guide

Usage

Browse to http://example.com/min/

The Minify URI Builder will help you create URIs you can use to minify existing files on your site. You can see screenshots and get a feel for this process from this walkthrough on mrclay.org

Browse to http://example.com/min/README.txt for more complete documentation.

Configuration

min/config.php holds general config options.

min/groupsConfig.php holds preset groups of files to minify. (The builder application can help with this).

CookBook shows how to customize settings between production/development environments, and between groups.

CustomSource shows how to set some file/source-specific options, or serve content from a PHP script or URL.

Problems?

See CommonProblems and Debugging. You might also try TestingMinify (running test_environment.php in particular).


Comment by shariff.yulop, Sep 25, 2008

hi guys, i have configured the minify to work in my server .. my question is how to i check whether the files are caching or not ...

any suggestions ...

Comment by st...@mrclay.org, Sep 26, 2008

I suggest you always set $min_cachePath in /min/config.php. That way you know where the files are stored and can check them. Without that set, they may be in /tmp or several other directories depending on your OS.

Comment by deadpan110, Oct 01, 2008

Using .htaccess and RewriteRule? for Minify

I used the following within .htaccess to minify all .js and .css on my WordPress? MU site:

# .htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^(.*\.(css|js))$ min/index.php?f=$1&debug=0 [L,NC]

# Note &debug=0 is not needed but I set it to 1 when needed
# (when $min_allowDebugFlag = true; is set within config.php)

I found this works great as I used this method in minify v1.0 but appears to break css background images.

/*wp-content/themes/mytheme/style.css*/

#someid {
    background: #6E6A66 url('pics/mygif.gif') repeat-x top;
}

becomes (According to my Firebug output)

This is fixed by using a previous mentioned option within config.php and switching the css URI rewrite option off.

$min_serveOptions['rewriteCssUris'] = false;

I hope this helps anyone attempting to do the same.

Comment by jasondaly, Oct 07, 2008

I am interested in a way to explicitly reference a group name to serve programatically, not pulling from the querystring. I have a self-built MVC framework, and have put the following code in a a method for one of my controllers

(From my <Controller_Proxy> class)

public function serve(){
  Minify::setCache();
  Minify::serve('Groups', array('groups' => $include_script_groups,
                                'maxAge' => 31536000));
}

as mentioned in the userguide, but my URL pattern (already using mod_rewrite) is

/controllerName/actionName/param1/param2/...

I would like to pass something like

/proxy/serve/core_css

but would like to know an option to pass to tell Minify to serve the 'core_css' group.

Comment by st...@mrclay.org, Oct 08, 2008

@jasondaly: It looks like you want the "Files" controller. Instead of selecting a key based on PATH_INFO (what Groups does), you just give it the piece of the array you want:

if (isset($include_script_groups[$param1])) {
    Minify::serve('Files', array('maxAge' => 31536000,
                                 'files' => $include_script_groups[$param1]));
} else {
    // 404
}
Comment by amitkhosla.jobs, Oct 22, 2008

how to call this peice of code Which url i should give?

"if (isset($include_script_groups$param1?)) {

Minify::serve('Files', array('maxAge' => 31536000,
'files' => $include_script_groups$param1?));
} else {
// 404
}"

When i try http://localhost/php/min.php?param1=scripts/script.js it says HTTP/1.0 400 Bad Request

though its working fine for the groups if i make grouping in php only. But what i want is i want to minify all the files in the parameter i pass.

Comment by st...@mrclay.org, Oct 23, 2008

if (isset($include_script_groups[$_GET['param1']])) { ...

Comment by covifox, Jan 13, 2009

Hi all. Ummm... a small suggestion:

I have Minify located in a static server and I used rewrite rules to serve false phisical files, stored through automatically merging arrays. This can output several 404 errors, especially serving groups, and I decided use the Quiet mode to check this.

I think can be useful (in quiet mode) a few more data, in the options array wich are returned from Base Controller when happen a error, think you?

I.Ex. and above all: a simple list of files that aren't found, or causes errors, instead the content item or another extra item.

  'success' => boolean false
  'statusCode' => int 400
  'content' => string ( true === debug ) ? list_of_wrong_files : Public error message (length=0)
  'headers' => 
    array
      empty

Cheers and congrats, I like your work.

Comment by prem.pillai, Mar 13, 2009

Can anyone here help Zend framework users to set this up. Thanks in advance.

Comment by st...@mrclay.org, May 12, 2009

@covifox: In config.php set $min_errorLogger = true; and check the HTTP headers in 400 responses (or check FirePHP) for errors.

Comment by covifox, Oct 15, 2009

Thanks for response and sorry by delay. I don't want know if have errors after output; I want know errors before output, for application (and my own automatic logger) not for me.

But this already don't matter. Thanks ;)


Sign in to add a comment
Hosted by Google Code