documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.io/jammit/
MIT License
1.16k stars 197 forks source link

Concatenate JavaScripts with semicolon. #217

Open lynaghk opened 12 years ago

lynaghk commented 12 years ago

Without a semicolon, JavaScript evaluates

a = b + c
(d + e).print()

as

a = b + c(d + e).print();

rather than

a = b + c;
(d + e).print();

This commit prevents that from happening by defensively adding a semicolon when joining JavaScripts.

dnsco commented 12 years ago

is this going to get merged? we occasionally have issues resulting from concatenation.

dougcole commented 12 years ago

This seems really valuable - is anything holding this up?

andrewhao commented 11 years ago

What compressors are you all using? By explicitly requiring Closure Compiler this issue went away for me (methinks JSMin uses a naive compression algorithm?).