views:

968

answers:

7

Hi

I am using jquery and I got a couple plugins that don't offer a minified version. So I want to take the full version and minfiy it but all the sites I have found that you input your javascript and it minifies it breaks the plugin.

Like it must strip something out because I get a syntax error.

So anyone got a good one that I can use?

A: 

That shouldn't happen with minification. Perhaps try minifying the files separately?

Steven Xu
I am minfiying them separately. The ones I am looking at you have to paste in your code and then it spits out a minified version.
chobo2
A: 

It could be because one or more files don't have a trailing semi-colon, which is usually fine but I think causes problem on minification. Alternatively you may have issues with regex literals. What minifier are you using?

cletus
I tried this one, http://www.minifyjavascript.com/index.php and another one but forgot the link.
chobo2
A: 

If you are minfying the plugins as separate files, the process may be renaming a symbol that is part of the jQuery API, because the minifier is not aware of the interaction.

Justin Love
I just copy and paste the javascript code into the box and hit generate. So maybe thats what it is doing.
chobo2
+2  A: 

Javascript Compressor Rater

I believe it runs the js through rhino and outputs any errors found before hand, and after you can choose the one that works best for you.

Corey Hart
A: 

ASP.net team published a free tool that enables you to improve the performance of your Ajax applications by reducing the size of its JavaScript files. The new tool is named the Microsoft Ajax Minifier. Deatails here: Deatails about Ajax Minifier

Download it here Download link

tuanvt
I will check it out. I found YUI compressor and that seems to work but don't like the command line interface
chobo2
+1  A: 

If you're familiar with Java you could also use YUI compressor to minify JS (and CSS) files yourself. We use it here as well and it works great.

BalusC
Ya I found this and it seems to work when I set the minify option and preserver semi coloumns
chobo2
A: 

If you have PHP5 and Zlib on your server, then try this one! http://code.google.com/p/minify/

I use it to combine jQ, jQ Plug-ins, jQ-UI, and custom site application client-code into a single file.

I then load that JS file and a small page-specific JS file (with onload, etc) onto each page. It works well...and it also handles CSS.

I don't leave home without it. (that's just a saying :)

Juggernt