FriendsOfREDAXO / minify

Minifiziert und bündelt CSS/Sass, JavaScript, HTML und Bilder im Medienpool.
MIT License
43 stars 5 forks source link

HTML Kommentare ohne Conditionals entfernen #42

Closed rkemmere closed 6 years ago

rkemmere commented 7 years ago

Hallo,

kann der preg_replace so angepasst werden, dass die conditionals comments erhalten bleiben? Es wäre außerdem gut, wenn man es um eigene non-capturing groups erweitern könnte.

Ein weiteres Problem ist, das search_it nicht mit dem minify HTML läuft, da search_it eigene Tags wie einbaut und diese eben nicht entfernt werden dürfen.

$content = preg_replace(['/<!--(.*)-->/Uis',"/[[:blank:]]+/"], ['',' '], str_replace(["\n","\r","\t"], '',$content));``

Mögliche Syntax.

<!-- #01: "<!--" (?! #02: look-ahead: a position not followed by: \s* #03: any number of space (?: #04: non-capturing group, any of: \[if [^\]]+] #05: "[if ...]" |<! #06: or "<!" |> #07: or ">" ) #08: end non-capturing group ) #09: end look-ahead (?: #10: non-capturing group: (?!-->) #11: a position not followed by "-->" . #12: eat the following char, it's part of the comment )* #13: end non-capturing group, repeat --> #14: "-->"

phoebusryan commented 6 years ago

Für das search_it-Problem gibt es bereits einen Pullrequest. Dem werde ich sicher bald nachgehen.

Bzgl. den Comments, das könnte man auch noch optmieren. Bitte ebenfalls als PR :)

phoebusryan commented 6 years ago

So, also die Unterstützung für search_it ist drin.

rkemmere commented 6 years ago

Super Danke!