Also talk about the compression of JS, jquery compression. Go

Source: Internet
Author: User
Tags base64 encode

The problem: responsible for the development of the company's research platform, consider the protection of intellectual property rights, we must consider the Java encryption technology and JS script encryption technology. In the current Java encryption is easy to crack the case, or the first to deal with the encryption and compression JS, on the one hand can improve page loading performance, on the other hand also hope that the results of hard research and development to be certain protection.

Research process:

1, the first strongly despise the people who casually reproduced the article, to me to create a lot of trouble!! Many posts on the Internet are not reliable.

2, first want to understand what jquery uses compression, online search for a half-day, the argument is not the same, later on the jquery official website of the most frequent problems found the answer, but this is already around a big circle after the thing.

(a) According to some of the information I've seen, jquery compression was first compressed with Dean Edwards ' Packer , probably in the jquery1.3 version (I saw it in a jquery book.) )。 This thing came out early, the author seems to be the first Daniel, is currently 3.0 version, as if the online version, I put the code to his website compression, can not be used, will be wrong.

(b) After jquery replaced with Yuicompressor for compression, which version is not very clear, the author of an article said: He went to jquery in the SVN find a bit, found that there are yuicompressor files, Then he deliberately used jquery.js to try, the processed documents and jQuery.min.js exactly the same. The original address.

(c) Oh, my God, I finally found this phrase on the jquery website. How does I compress my code?

The contents are as follows:

Generally the best of the Closure Compiler (used by jQuery) or YUI compressor. jquery provides a pre-minified version of jquery for your convenience.

Packing JavaScript using Dean Edwards ' Packer (specifically using the Base64 encode) is not recommended, as the Client-sid E decoding have significant overhead that outweighs the file-size benefits.

The general meaning is to say: jquery uses Google's Open source JS compression tool, Google Closure compiler and Yui compressor is the best way to JS compression. Dean Edwards ' Packer is not recommended!!

Post-mortem impressions:

1. In fact, I notice the Google Closure compiler this tool, but by a netizen's misleading, not to try. He put forward 2 reasons, one is that this thing open source not long, second, this will rewrite and optimize your code structure and there are a few serious problems; I was looking for jquery with what compression tool. TMD this technical article written by the Chinese is not credible, everywhere JB disorderly copy!! Many things have to look at the official website documents.

2. Google is a great company, its technology is in the forefront, Yui was developed by Yahoo, the past few years Yahoo, I think Google absorbed a lot of the current IT field of technical experts, we should believe that its products are fine.

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.