Should I use the YUI Compressor or the new Google Closure compiler to compress my JavaScript?

前端 未结 7 1896
野趣味
野趣味 2021-01-30 08:47

YUI Compressor was the consensus best tool for minimizing, but Closure seems like it could be better.

7条回答
  •  -上瘾入骨i
    2021-01-30 09:00

    I think it depends on your code. If you want to compile your own code, then I think it is worth it to patch the code so that it works with Closure Compiler (some things might seem a bit awkward at the start). I believe Closure Compiler soon will be the top choice for such jobs and it will also make you to tidy up your code a bit and maintain consistent style (of course it depends on your preferences, you might hate some parts, I do :P ).

    If you depend on other libraries then in my opinion you should wait a bit until they release Closure Compiler compatible versions. It shouldn't take much time for most popular libraries out there. And maybe you can provide fixes for those "not-so-active" libraries which you use yourself.

    I'm talking about Advanced Compilation mode here, the Simple Compilation mode as some has pointed out is fairly safe to use.

    And here's a different opinion - Google Closure ? I'm Not Impressed. It's maybe a little bit too harsh, but nice read. I guess only time will tell which one is better =)

提交回复
热议问题