Precautions for yui compressor

Source: Internet
Author: User

My js and css contacts include jsMin, jsPacker, yui compressor, and google Closure compress.

These compression comparison of many articles, of which google Closure compress many people advocate, I also recommend it, here YU Bo students summarized the yui compressor and google Closure compress comparison: http://www.slideshare.net/lifesinger/closure-compiler-vs-yuicompressor

 

Recently, I found that yui compressor2.4.2 has some problems in compressing and confusing js scripts, so I want to change it to google Closure compress immediately. However, I am lazy and don't want to change the content of the ant script for automated packaging. In addition, many compression tools I have not collected execution programs and cannot be executed automatically. Try the latest yui compressor version yui compressor2.4.7 In the lazy method. The problem is solved.

Here I found some precautions for yui compressor2.4.2 for reference only:

1) after compression obfuscation, You can manually or automatically write data at the beginning. "<! -- ", Write at the end" --> ". This is not the reason.

2) // "and" */"cannot be in the same row; otherwise, an error is returned.

For example:

Error:

/* Var s = 2;

Var m = 1; // define */

Correct:

/* Var s = 2;

Var m = 1; // define

*/

3) Chinese problems.

However, I found that some Chinese characters have problems (I have to go further here to find out the cause)

For example, var s = "" will report an error. If there is an error in "Multi-end" compression obfuscation, you can load a space behind the multiple to solve the problem.

But now, version 2.4.7 has been completely resolved. V5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.