views:

137

answers:

1

Hi there,

I am trying to find some sort of gui or batch utility where i can YUI compress a JS file i have.. I have a utility that sort of consolidates all my js into 1 single js .. and works great but i need to compress this file..

I was using something similar before to compress but it failed on european character i.e. character with accents over letters... like Día , Sábado etc

So basically what happend was it worked great but when i had a string with a european word with accents on it.. it would put escape characters in etc... I had to manually edit it.. it was a nightmare.-..

Can anyone point me in the right direction of a good GUI that works with YUI or somehtign similar so i can point it to my file (and files and i have more than one) so i can just one it like in batch mode or similar.. It needs to compress jquery also... i suppose yui has no issues with this?

Does anyone know if something like this exists at all?

I didn't really want to use the command like as i have a few files...

Any help really appreciated

+1  A: 

My suggestion may not be exactly what you are looking for, but I am using batch file(s) to drive the compression/packaging of multiple JS files.

Without any special batch file fu, and assuming your on Windows, you could write a batch file similar to this (in the order in which you want the files to load in the browser):

compress.cmd:

echo. > compressed.js
java -jar yuicompressor-2.4.2.jar jquery.js >> compressed.js
java -jar yuicompressor-2.4.2.jar file1.js >> compressed.js
java -jar yuicompressor-2.4.2.jar file2.js >> compressed.js

You can then run this anytime you need to "re-package" everything into the single deployment file "compress.js".

BTW, make sure all your JavaScript source files are UTF8 and then run the compressor with the --charset UTF-8 option; this should take care of character encoding issues.

Thomas Jung