ded / klass

a utility for creating expressive classes in JavaScript
753 stars 78 forks source link

Semi-colon at the end #9

Closed willbamford closed 12 years ago

willbamford commented 12 years ago

Would it be possible to insert a semi-colon right at the end of the script? I'm using juicer (https://github.com/cjohansen/juicer) for compilation (merging) and without this I'm experiencing an error ("...return this;};context.klass = klass;return klass;}) is not a function").

ded commented 12 years ago

interesting. i can do this, but it might be a good idea to ask the juicer folks to insert semi-colons between concatenated files

rbdcti commented 12 years ago

This happens for me with minify as well. I'm using django-compressor. Everything else is minified fine except for klass.js, and I get this same error. Inserting a semicolon at the end of the file fixes it. Would love to see this issue resolved.

ded commented 12 years ago

ok. perhaps it's the safest thing to do for each module then, for the sake of avoiding this everywhere is to just put a semi-colon at the end.

rbdcti commented 12 years ago

Probably. I've looked at a number of other jquery modules and every single one of the ones I've seen have a semicolon at the end (a few even have it at the start as well, like jquery.form and jpajinate).

As it is now, the browser pukes on it if it's minified (EDIT: I had said minify pukes on it but that was incorrect). I minify myself because I combine the unminified klass.js with a number of other .js files into a single minified bundle.

ded commented 12 years ago

more than likely jQuery (and several others) end with semi-colons because people are using semi-colons - in general. my general coding style is that they are optional and you don't need them 99% of the time. so i omit them. for this case, however, it seems as tho i'll have to start including them at the end of the files (oddly enough).