mirror of
https://github.com/mrclay/minify.git
synced 2025-08-11 08:34:19 +02:00
Exclude SSI Comments (#670)
* Exclude SSI comments Exclude Nginx & Apache Server Side Include (SSI) comments from being stripped via minification, the same way IE directives are not stripped. Both Nginx & Apache SSI directives begin with: <!—# So we can just look for the # and don’t strip the comment in that case. Nginx SSI: http://nginx.org/en/docs/http/ngx_http_ssi_module.html Apache SSI: https://httpd.apache.org/docs/2.4/howto/ssi.html * Add tests for Nginx/Apache SSI directives Co-authored-by: Andrew Welch <andrew@keluli.local>
This commit is contained in:
@@ -164,7 +164,7 @@ class Minify_HTML
|
||||
|
||||
protected function _commentCB($m)
|
||||
{
|
||||
return (0 === strpos($m[1], '[') || false !== strpos($m[1], '<!['))
|
||||
return (0 === strpos($m[1], '[') || false !== strpos($m[1], '<![') || 0 === strpos($m[1], '#'))
|
||||
? $m[0]
|
||||
: '';
|
||||
}
|
||||
|
Reference in New Issue
Block a user