• Resolved dbro

    (@dbro)


    I wanted to keep some comments like <!–googleoff: all–>

    So I added this code in replacement from the old:

    if ($minify_html_comments != 'no') {
      $process = preg_replace('/(<!--{)(.*)(}-->)/','@#_###{$2}###_#@', $process);
      $process = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->).)*-->' . $mod, '', $process);
      $process = preg_replace('/(@#_###{)(.*)(}###_#@)/','<!--$2-->', $process);
    }

    Then I rewrote the comment as: <!–{googleoff: all}–>
    And now it keeps the comment. ??

    Just thought I would share.

Viewing 1 replies (of 1 total)
  • Thread Starter dbro

    (@dbro)

    Sorry needs to be ungreedy.. use this instead:

    if ($minify_html_comments != 'no') {
      $process = preg_replace('/(<!--{)(.*?)(}-->)/','@#_###{$2}###_#@', $process);
      $process = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->).)*-->' . $mod, '', $process);
      $process = preg_replace('/(@#_###{)(.*?)(}###_#@)/','<!--$2-->', $process);
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Keeping some comments..’ is closed to new replies.