nathansmith / formalize

Teach your forms some manners!
http://formalize.me
1.31k stars 120 forks source link

Missing Semicolon #66

Closed easyeisme closed 11 years ago

easyeisme commented 11 years ago

I noticed there's a missing semicolon at the very end of assets/js/jquery.formalize.min.js. If the file is linked to a web page independently, then this doesn't appear to cause a problem. However, as I was concatenating the contents of this file with other libraries/plugins into a single javascript file, an error was triggered if the formalize code block was followed by another self-invoking function.

nathansmith commented 11 years ago

Are you just concatenating by adding them together, or are you running them through a processor like Grunt.js?

http://gruntjs.com

If you're doing the latter, I would suggest starting with the un-minified version of Formalize first, and letting the automated process handle the minificaiton and concatenation for you.

Or, alternatively, you could run manual concatenation first (using the un-minified Formalize file), and then run minification on the resulting file, after all the other JS files are combined.


For what it's worth, I used UglifyJS to minify Formalize…

https://github.com/mishoo/UglifyJS

easyeisme commented 11 years ago

I'm just concatenating my JS assets by hand using the minified version of each library/plugin. I've attached a copy of the end-result file, if you'd like to take a look at it. Without the semicolon at the end of the Formalize.me block, it triggers an error on the Masked Input plugin. Hope this has been helpful.

Have a good one, Eric

On Mon, Sep 9, 2013 at 11:37 AM, Nathan Smith notifications@github.comwrote:

Are you just concatenating by adding them together, or are you running them through a processor like Grunt.js?

http://gruntjs.com

If you're doing the latter, I would suggest starting with the un-minified version of Formalize first, and letting the automated process handle the minificaiton and concatenation for you.

Or, alternatively, you could run manual concatenation first (using the un-minified Formalize file), and then run minification on the resulting file, after all the other JS files are combined.

— Reply to this email directly or view it on GitHubhttps://github.com/nathansmith/formalize/issues/66#issuecomment-24087090 .

nathansmith commented 11 years ago

Ah, okay.

Since you're concatenating by hand, I guess you'll just have to manually add the semi-colon.

Reason being, the next time I run an automated process to minify Formalize, the semi-colon will be missing again.

Since the point of minifiers is to save bytes, I'm not sure any automated minification process is going to result in a semi-colon where you'd want it.

Again, I'd recommend starting with un-minified files, concatenate them, and then run that result through a minifier.

By the way, because you replied to the GitHub reply-thread, your attachment didn't come through. I'm viewing this conversation here, not replying by email…

http://j.mp/195vhCX

easyeisme commented 11 years ago

Yep, and that's what I've done on my project. Just wanted to make you aware. Thanks, Nathan!