Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

YUI compressor changes now supports old @licence tag to preserve lice…

…nse comments
  • Loading branch information...
commit a3e07d0dab6a936dccb8240603199a3731aec19e 1 parent b30194f
Juan Pinzon juanpin authored

Showing 1 changed file with 25 additions and 1 deletion. Show diff stats Hide diff stats

  1. +25 1 lib/sproutcore/build_tools/resource_builder.rb
26 lib/sproutcore/build_tools/resource_builder.rb
@@ -147,7 +147,31 @@ class JavaScriptResourceBuilder < ResourceBuilder
147 147
148 148 # Final processing of file. Remove comments & minify
149 149 def join(lines)
150   -
  150 + if bundle.minify?
  151 + # first suck out any comments that should be retained
  152 + comments = []
  153 + include_line = false
  154 + lines.each do | line |
  155 + is_mark = (line =~ /@license/)
  156 + unless include_line
  157 + if is_mark
  158 + include_line = true
  159 + line= "/*!\n"
  160 + end
  161 + is_mark = false
  162 + end
  163 + if include_line && is_mark
  164 + include_line = false
  165 + comments << "*/\n"
  166 + elsif include_line
  167 + comments << line
  168 + end
  169 + end
  170 + # now minify and prepend any static
  171 + comments.push "\n" unless comments.empty?
  172 + comments.push (lines * '')
  173 + lines = comments
  174 + end
151 175
152 176 lines.join
153 177 end

0 comments on commit a3e07d0

Please sign in to comment.
Something went wrong with that request. Please try again.