Javascript compression and jquery compression (improving page loading performance/protecting labor results) _ javascript skills

Source: Internet
Author: User
Tags base64 encode
The encryption and compression of javascript can improve the page loading performance, and also hope that the hard-developed results will be protected. Interested friends can learn about it, it may be helpful to you Cause: Responsible for the R & D of the company's development platform. to protect intellectual property rights, you must consider java encryption technology and js script encryption technology. In the current situation where java encryption is very easy to crack, we should first encrypt and compress Javascript. On the one hand, it can improve the page loading performance, on the other hand, we also hope that the hard-developed results will be protected.

Study Process:
1. First, I strongly despise the guys who casually reprinted the articles, which made me a lot of trouble !! Many posts on the Internet are unreliable ..
2. First, I want to know what compression is used by jquery. I have been searching for it for a long time on the Internet. I found the answer to the most frequently asked questions on the jquery official website, however, this is already a thing after a large circle.
(A) According to some information I have seen, jquery compression was first compressed using Dean Edwards 'packer, probably in jquery1.3 (I saw it in a jquery book .). This is a relatively early version. The author seems to be the first master. Currently, it is version 3.0. It seems to be an online version. I compress the code on his website and cannot use it. An error may occur.
(B) After jquery is changed to yuicompressor for compression, the specific version is not clear. The author of an article said: he found the file yuicompressor in jquery's svn, then he specifically used jQuery. js tried it and processed files and jQuery. min. js exactly. Original post address.
(C) I finally found this article on the jquery official website. How do I compress my code?

The content is as follows::
Generally the best way to do it is to use the Google 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-side decoding has significant overhead that outweighs the file-size benefits.
Jquery uses google's open-source js compression tool. Google Closure Compiler and YUI compressor are currently the best JavaScript compression methods. Dean Edwards 'packer is not recommended !!

Post-event Thoughts:
1. I have noticed Google Closure Compiler for a long time, but I was misled by a netizen and did not try it out. He proposed two reasons: one is that it is not long before the open source, the other is that it will rewrite and optimize your code structure, and there are several serious problems at present; I was always looking for the compression tool used by jquery. TMD is a technical article written by Chinese people. It is untrusted. JB is everywhere !! A lot of things need to be viewed on the official website.
2. google is a great company with cutting-edge technologies. Before YUI, IT was developed by Yahoo. In recent years, Yahoo's performance was poor. I think Google has absorbed many technical experts in the current IT field, we should believe that all of its products are excellent products.

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.