title: How to minify css on the fly?
body: <p>I'm trying to minify the css on the fly in WordPress because if I do the minify directly my theme won't work when the comment gets removed.</p>
  
  <p>First I tried to remove comments from any specified css file its working fine here is the code</p>
  
  <pre><code>&lt;?php
  $cssfile = 'style.css';//css file needed to minify
  $file = fopen($cssfile, 'r');
  if ($file) {
      $buffer = file_get_contents('style.css');//getting content of css file needed to minify
      $buffers = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
  
      echo $buffers;
  }?&gt;
  </code></pre>
  
  <p>Same thing I want to do on the fly. In many tutorialS all uses <code>ob_start()</code> and saying about <code>http request</code>. I don't know these things and what they dos and also I am  unable to see where they are specifying the file path like I did in the 1st line <code>$cssfile</code></p>
  
  <p>I think they are telling <code>$_GET[something]</code> for file. Is this where they mentioning the css file which needs to be minify?(Mentioning path to the css)</p>
  
  <p>Can any one help me on this to do a on the fly css minify with explain of ob_start(), http request and how it works.</p>