You are already familiar with the ob_start() method.
But I will show a better alternative (and faster):
Your main file:
$cssFiles = array( "base-styleseet.php", "specific-stylesheet.php" ); $buffer = ""; foreach ($cssFiles as $cssFile) { $buffer .= include($cssFile); } minifyCSS($buffer); echo $buffer;
Well, nothing special here. Just added include() there ...
But it will not work as intended, if you do not, for each file:
- Create a heredoc with all the content
- Get him back
As an example, you can use the base stylesheet:
<?php
* Ignore broken syntax highlighting
And you're done.
No longer against ob_start() !!!
In addition, CSS comments use the syntax /* */ , // will be evaluated as an invalid CSS selector.
Ismael Miguel
source share