Open julkue opened 9 years ago
The short answer is putting [] square brackets inside the comment will keep it included - and its whitespace intact.
<!--[
/**
* Some copyright
*
*/
]-->
The alternative - we can edit HTMLmin.php to keep the comment:
Line 50:
foreach ($xpath->query('//comment()') as $comment) {
$val= $comment->nodeValue;
if( strpos($val,'[')!==0 && strpos(strtolower($val),'copyright')!==0 ){
$comment->parentNode->removeChild($comment);
}
}
Thanks for the hint. But isn't it possible to pass a individual structure for copyrights as a parameter?
Its a good idea. I can add that feature no problem.
For now you could just so a str_replace
str_replace("</body>",$mynotice.”</body>”,$html)
On Mar 31, 2015, at 11:35 PM, Julian notifications@github.com wrote:
Thanks for the hint. But isn't it possible to pass a individual structure for copyrights as a parameter?
Am 31. Mär. 2015 17:45, um 17:45, ztkemsley notifications@github.com schrieb:
The short answer is putting [] square brackets firectly inside the comment will keep it included - and its whitespace intact.
<!--[ /** * Some copyright * */ ]-->
The alternative - we can edit HTMLmin.php to keep the comment:
Line 50:
foreach ($xpath->query('//comment()') as $comment) { $val= $comment->nodeValue; if( strpos($val,'[')!==0 && strpos(strtolower($val),'copyright')!==0 ){ $comment->parentNode->removeChild($comment); } }
Reply to this email directly or view it on GitHub: https://github.com/searchturbine/phpwee-php-minifier/issues/1#issuecomment-88138409 — Reply to this email directly or view it on GitHub https://github.com/searchturbine/phpwee-php-minifier/issues/1#issuecomment-88162985.
Yes but my problem is that the copyrights are in the HTML itself, so I would replace them with a regex first and store them to a temporary variable. After the minify I would need to add them again. Therefore I would need to know where to put them. A bit complex I think.
Sure - so the logic you want is to keep all of your html comments that contain the word copyright? Perhaps a parameter set regex matches for comments to keep?
We already do have a system for identifying comments you want to keep:
<!--[
/**
* Some copyright
*
*/
]-->
Can you explain why that is unworkable so i can understand?
Hello,
my copyrights look like
How can I ignore those from compressing HTML?