Habari Plugin: Minify

tags: , , ,

A plu­gin for Habari that makes use of the minify project to com­bine and com­press javascript and CSS. Although this is basi­cally just a minify wrap­per, I’d still con­sider it alpha sta­tus, so use at your own risk!

From the minify project page:

Minify is a PHP5 app that can com­bine mul­ti­ple CSS or Javascript files, com­press their con­tents (i.e. removal of unnec­es­sary whitespace/​comments), and serve the results with HTTP encod­ing (gzip/​deflate) and head­ers that allow opti­mal client-​side caching. This helps you fol­low sev­eral of Yahoo!‘s Rules for High Per­for­mance Web Sites.

To enable mini­fi­ca­tion for your theme stylesheet(s), you’ll need to add them to the template_stylesheet stack, like so:

Stack::add('template_stylesheet', array(Site::get_url('theme').'/style.css', 'screen'), 'style');
view raw gistfile1.php This Gist brought to you by GitHub.

You can then remove the stylesheet from the head sec­tion of the theme HTML. Also, make sure the theme is call­ing theme_header() some­where in the head section.

Down­load at GitHub

Feedback