Archive for December, 2012

Page 1 of 1

Minify on the Fly? Probably Not The Best Idea

In order to serve up better performance on my site I minify my JavaScript and css files using cssmin and jsmin (in spite of the author’s exhortations to do otherwise) respectively, but I don’t do it in the most efficient manner possible. I’m basically serving up those cache files on the fly, making it the old school, non production method for doing this. I’m not actually processing the files on the fly, however, only checking to see if a source file has been modified before rebuilding the cache.

I’m running it all through the WordPress wp_enqueue_script/wp_enqueue_style system in my custom theme, but I need to find a method that would work more efficiently in a high traffic environment–not that I have that problem at the moment–instead of serving up those cache files using php.

I thought about running a cron job that would take care of the minification, then just link the theme to minified css or js files. Any ideas?