Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…nse comments
  • Loading branch information...
commit a3e07d0dab6a936dccb8240603199a3731aec19e 1 parent b30194f
@juanpin juanpin authored
Showing with 25 additions and 1 deletion.
  1. +25 −1 lib/sproutcore/build_tools/resource_builder.rb
View
26 lib/sproutcore/build_tools/resource_builder.rb
@@ -147,7 +147,31 @@ class JavaScriptResourceBuilder < ResourceBuilder
# Final processing of file. Remove comments & minify
def join(lines)
-
+ if bundle.minify?
+ # first suck out any comments that should be retained
+ comments = []
+ include_line = false
+ lines.each do | line |
+ is_mark = (line =~ /@license/)
+ unless include_line
+ if is_mark
+ include_line = true
+ line= "/*!\n"
+ end
+ is_mark = false
+ end
+ if include_line && is_mark
+ include_line = false
+ comments << "*/\n"
+ elsif include_line
+ comments << line
+ end
+ end
+ # now minify and prepend any static
+ comments.push "\n" unless comments.empty?
+ comments.push (lines * '')
+ lines = comments
+ end
lines.join
end
Please sign in to comment.
Something went wrong with that request. Please try again.