The Buffet Framework – Adding Minify

While we wait for Arras Theme 1.3.0 to get approved and posted up into the WordPress themes directory, let’s shift the focus back to the Buffet Framework.

I have been actively developing the framework, pushing in new ideas and finding simple approaches to make theme development much easier. If you have actually explored the repository up at Google Code, you would have noticed some additions into the framework.

Minify Support

One of the main features that I have been trying is to add support for Minify, which allows you to combine, minify and cache your CSS and JS files. WordPress actually has an internal caching feature for their CSS and JS files that will be implemented in 2.8, but it will only be used in admin. So to provide support for this app, the theme developer would probably have to do the following things:

  • Define the path Minify is installed, with their own configuration.
  • Use wp_enqueue_script to add their own JS files instead of echoing out the HTML tags like you would normally do.
  • Use a special framework function bf_add_stylesheet to include your stylesheet instead of using @import or the <link> tag.

As long as the path to the installation path is defined, the framework will kick in and add an option into the admin to allow theme users to enable or disable the feature. An additional option will also appear to allow the users to delete the cache should they change anything in their CSS and JS files.

This feature should appear in the 0.6 stable release of the framework.

5 Comments
  1. You might check out WP Minify, but I encourage you to try your own hand at it as well; competition is good. Hit up the Minify group if you have any questions.

    • zy says:

      If I’m not wrong WP Minify does not minify the CSS frontend. Theme developers would normally include their stylesheets using the link HTML tag or @import.

  2. According to this, WP Minify only sees scripts and styles enqueued via wp_enqueue_script() and wp_enqueue_style(), but it also has an options page to manually add CSS/JS files to these queues. I’d guess you’d need to remove/comment out the CSS link/@import in your theme and add the stylesheet in the WP Minify options.

    • zy says:

      wp_enqueue_style() only works in the admin panel. In fact, BackPress in WordPress 2.8 will have built-in minifying and caching features. So the plugin might only be of use in the frontend (for those using wp_enqueue_script).

      What I have done for the framework is by using wp_enqueue_script and the framework stylesheet function, it will determine where the minify installation path is (developers might want to customize the config.php in minify itself, that’s why it is not included in the framework) and whether the theme user want is enabled before proceeding with the minify process.

  3. You do not appear to be actively maintaining your blog anymore. Is it safe to assume you are no longer “actively developing the framework”?