Slightly improve the minify regexes
This commit is contained in:
parent
313f6f8214
commit
7c78b20f65
2 changed files with 2 additions and 2 deletions
|
@ -47,7 +47,7 @@ module Middleman::Extensions
|
||||||
if path.end_with?('.html') || path.end_with?('.php')
|
if path.end_with?('.html') || path.end_with?('.php')
|
||||||
uncompressed_source = extract_response_text(response)
|
uncompressed_source = extract_response_text(response)
|
||||||
|
|
||||||
minified = uncompressed_source.gsub(/(<style[^>]*?>\s*(?:\/\*<!\[CDATA\[\*\/\n)?)(.*?)((?:(?:\n\s*)?\/\*\]\]>\*\/)?\s*<\/style>)/m) do |match|
|
minified = uncompressed_source.gsub(/(<style[^>]*>\s*(?:\/\*<!\[CDATA\[\*\/\n)?)(.*?)((?:(?:\n\s*)?\/\*\]\]>\*\/)?\s*<\/style>)/m) do |match|
|
||||||
first = $1
|
first = $1
|
||||||
css = $2
|
css = $2
|
||||||
last = $3
|
last = $3
|
||||||
|
|
|
@ -47,7 +47,7 @@ module Middleman::Extensions
|
||||||
if path.end_with?('.html') || path.end_with?('.php')
|
if path.end_with?('.html') || path.end_with?('.php')
|
||||||
uncompressed_source = extract_response_text(response)
|
uncompressed_source = extract_response_text(response)
|
||||||
|
|
||||||
minified = uncompressed_source.gsub(/(<script[^>]*?>\s*(?:\/\/(?:(?:<!--)|(?:<!\[CDATA\[))\n)?)(.*?)((?:(?:\n\s*)?\/\/(?:(?:-->)|(?:\]\]>)))?\s*<\/script>)/m) do |match|
|
minified = uncompressed_source.gsub(/(<script[^>]*>\s*(?:\/\/(?:(?:<!--)|(?:<!\[CDATA\[))\n)?)(.*?)((?:(?:\n\s*)?\/\/(?:(?:-->)|(?:\]\]>)))?\s*<\/script>)/m) do |match|
|
||||||
first = $1
|
first = $1
|
||||||
javascript = $2
|
javascript = $2
|
||||||
last = $3
|
last = $3
|
||||||
|
|
Loading…
Reference in a new issue