Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

icing on "Combining and Minifying CSS the right way"

$
0
0

I have read that combining and minifying CSS saves useful bandwidth and increases the general performance of the website. Most of the CSS Minify tools remove the commented out text from a CSS file. This is part of optimization as the browsers do not need that information.

But the problem here is that wordpress depends on some commented out text which lies on top of theme css file. Such as this:

/*
Theme Name: Response
Theme URI: http://cyberchimps.com/cyberchimps-free/
Author: CyberChimps
Author URI: http://www.cyberchimps.com/
Description: A Free HTML5 Responsive Drag & Drop Starter WordPress Theme by CyberChimps WordPress Themes featuring Twitter Bootstrap, and responsive touch friendly theme options.
Version: 2.1.6
*/

There is also a way to bypass this dependence using some php hacks. Minify WordPress theme stylesheets-Kuttler This is a post from Nicolas Kuttler from 2010. Now being 2013, I suppose there is another way to do this.

So, my question to you is:

  1. If the CSS header information is not there in the minified CSS, which will be served to the browsers. What php code should be added to functions.php of child theme, so that Wordpress doesn't break? Maybe using is_admin function.
  2. What code should be added to functions.php to serve style.min.css and not load the actual style.css?

Viewing all articles
Browse latest Browse all 8245

Trending Articles