You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So you want to only strip comments off your CSS...read on!
How to strip comments only from CSS with minify
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. 😃
Hello
All is working fine,
only i am want to remove/hide all css comments from minify output so please help me.
Thanks
The text was updated successfully, but these errors were encountered: