2

I'm trying to find a single-packaged javascript minifier written in javascript for use outside of the browser. I've normally gone with Dean Edward's /packer/, however, after further inspection of the source code, there are way too many dependencies involved such as his custom base2 library for eliminating common browser incompatibilities (of course this entire library won't work for running the script outside of a browser!) and Base (his custom library for basic javascript class inheritance).

My only other option would be for me to digest the pure PHP port of /packer/ and essentially re-translate the code back into javascript (of course the PHP version doesn't have these dependencies, so this might be what I want).

Of course, I would like to know if there are any other solutions before I embark on my translation of the entire 17K file.

jerluc
  • 4,186
  • 2
  • 25
  • 44

1 Answers1

1

Would googles closure compiler be a candidate? There are several ways to use it, see documentation

Douglas Crockford also wrote a jsmin, it's a stand alone executable, written in c.

On this page I found a js-only minifier (the script is here)

KooiInc
  • 119,216
  • 31
  • 141
  • 177
  • I downloaded it, but of course its a JAR executable, which of course is another option to execute this separate process, however, I was really hoping for a javascript solution so I wouldn't have to worry about invoking the outer process. – jerluc Jun 29 '11 at 09:08
  • Hi jerluc, see my edits: found some more links that may suite you? – KooiInc Jun 29 '11 at 10:19
  • Yeah I was looking at that last one earlier, the nicest part is that it's all contained in one function, and even though it doesn't compress nearly as much as packer or the closure compiler, it's probably what I'll have to use. Thanks! – jerluc Jun 29 '11 at 17:15