Quantcast
Channel: PHP Dev Tips
Viewing all articles
Browse latest Browse all 10

MagicMin Version 3 Available!

$
0
0

Minifying CSS and Javascript just got way more awesome with MagicMin 3.0.0!

Along with better directory path support for windows machines, V3 includes the ability to output merged/minified files with unique hashed filenames for better caching support decreases your performance rating).

Unique generated filenames are also considerably more reliable when it comes to ensuring your visitors always have the most current content, as each time a new minified or merged file is generated- so is a new filename for the file!

require_once( 'class.magic-min.php' );
//Use google closure API, gzip the resulting file, and hash filenames
$minified = new Minifier( 
    array(
        'gzip' => true, 
        'closure' => true, 
        'hashed_filenames' => true
    )
);

So whereas previously, your source code would’ve looked something like…

<link rel='stylesheet' href='http://yoursite.com/styles.css?v=1.2.1' type='text/css'  />

Now they’ll look like…

<link rel='stylesheet' href='http://yoursite.com/d268f0e1f49d63aa24d87004673ec6e05855deb1.css' type='text/css' />

And (if and) when the minified file is regenerated to merge in changes, the filename will be freshly generated and would be something similar to…

<link rel='stylesheet' href='http://yoursite.com/c195919e63da89bba8bc7d80df64873609681732.css' type='text/css' />

Backward compatibility

100%. If you’ve already been using MagicMin, the updates will never break what you already have (because I use it too!)

[dm]18[/dm]

The post MagicMin Version 3 Available! appeared first on PHP Dev Tips.


Viewing all articles
Browse latest Browse all 10

Trending Articles