My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
UserGuide  
Your friendly guide to installing and using Minify.
Phase-Deploy, Featured
Updated Jan 26, 2012 by mrclay....@gmail.com

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

Installing Minify for the first time

  1. Clone the minify git repository. Alternatively, you may download the latest release and unzip it into a new "minify" directory.
  2. The distribution contains a folder "min". Copy this into your DOCUMENT_ROOT so it is a direct child of DOCUMENT_ROOT (e.g. http://example.com/min/). Document roots are usually named htdocs, public_html, or www.

If you place "min" in a subdirectory (e.g. http://example.com/mySite/min/), you should read and follow the instructions at AlternateFileLayouts carefully, or CSS URI rewriting will not work. Also in a subdirectory the BuilderApp will not function properly, but it's not necessary for Minify's functionality.

Done!

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

Hosting on Lighttpd

Minify comes with Apache mod_rewrite rules, but this does the same for Lighttpd:

url.rewrite-once = ( "^/min/([a-z]=.*)" => "/min/index.php?$1" )

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....@gmail.com, 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 project member mrclay....@gmail.com, 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 deadpan...@gmail.com, Oct 1, 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 7, 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 project member mrclay....@gmail.com, Oct 8, 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 project member mrclay....@gmail.com, Oct 23, 2008

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

Comment by project member mrclay....@gmail.com, Jan 18, 2011

Please use the Google group for support questions.

Comment by sidramuj...@gmail.com, May 8, 2011

Nice post thanks for sharing with us. I think we all should appreciate the efforts of the owner of this blog and the writer of this article as well.

http://marialist.com/-1/posts/3_Real_Estate/19_Apartments/946_find_classified_like_Craigslist_Memphis.html

Comment by lawrence...@gmail.com, Nov 27, 2011

How to make sure the $min_cachePath was set correctly? I find that even I set a invalid path, the program still works.


Sign in to add a comment
Powered by Google Project Hosting