Open ProgrammerNomad opened 6 years ago
I would also like to know how to do this.
So you want to only strip comments off your CSS...read on!
This is not something that is supported out-of-the-box, but if you are willing to do some really tiny hacking, you will get it working! This is what you must do:
I suppose you have the source code somewhere, let's say it is in a directory called minify. Open minify/lib/Minify/CSS/Compressor.php
and replace the whole function
protected function _process($css)
{
...
}
with this one
protected function _process($css)
{
// apply callback to all valid comments (and strip out surrounding ws)
$pattern = '@\\s*/\\*([\\s\\S]*?)\\*/\\s*@';
$css = preg_replace_callback($pattern, array(get_called_class(), '_commentCB'), $css);
return trim($css);
}
That's it! Have fun stripping comments only off your CSS. :smiley:
Hello
All is working fine,
only i am want to remove/hide all css comments from minify output so please help me.
Thanks