Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve script tag regex

  • Loading branch information...
commit bf0f177b58d7923a7a51ad79393eb105796735c5 1 parent a643580
@KlausTrainer authored
Showing with 1 addition and 2 deletions.
  1. +1 −2  couchapp-compress
View
3  couchapp-compress
@@ -5,7 +5,6 @@ COMPRESSOR = "uglifyjs -nc"
def doit!
exit_and_print_usage! if ['-h', '--help'].include?(ARGV.first)
-
destination = if ['-d', '--destination'].include?(ARGV.first)
unless ARGV[1]
exit_and_print_usage!
@@ -38,7 +37,7 @@ def doit!
# and insert the concatenated compressed scripts instead
compressed_scripts_files = []
htmls.each_with_index do |html, i|
- script_regex = /<script +src=['"]([^'"]+)['"]>.*<\/script>/
+ script_regex = /<script (?:[^>]* )?src=['"]([^'"]+)['"](?: [^>]*)?>.*<\/script>/
script_paths = html.scan(script_regex).flatten
html_without_scripts = html.gsub(/#{script_regex}/, '')
compressed_scripts = compress_and_concat_scripts(script_paths)
Please sign in to comment.
Something went wrong with that request. Please try again.