Egret's Jszip Advanced application: Compression JS

Source: Internet
Author: User

This piece explains Egret uses the Jszip to parse the pressurized JS code, then restores it to the executable JS code.

First, pack the Egret library:

①: Build a Egret folder in the root directory of the Web site where you put the class library

650) this.width=650; "title=" 03.png "src=" https://s2.51cto.com/wyfs02/M00/07/F6/wKiom1nXN_ Hwyq8taadkokxcwbw778.png-wh_500x0-wm_3-wmp_4-s_3684051099.png "alt=" wkiom1nxn_hwyq8taadkokxcwbw778.png-wh_50 "/ >

②: Package The Egret folder as a egret.zip


Two, package the main.min.js into a main.min.js.zip


Three, index.html

<! doctype html>

Website structure:

650) this.width=650; "title=" 04.png "src=" https://s2.51cto.com/wyfs02/M01/A6/A8/ Wkiol1nxp8ybutewaadwtxdautm482.png-wh_500x0-wm_3-wmp_4-s_2017195991.png "alt=" Wkiol1nxp8ybutewaadwtxdautm482.png-wh_50 "/>


To view loading results using a browser:

650) this.width=650; "title=" 02.png "src=" https://s4.51cto.com/wyfs02/M02/07/F6/ Wkiom1nxqeurzao4aaa8tck2uv0103.png-wh_500x0-wm_3-wmp_4-s_3380962785.png "alt=" Wkiom1nxqeurzao4aaa8tck2uv0103.png-wh_50 "/>


If you do not use compression, the result is:

650) this.width=650; "title=" 01.png "src=" https://s5.51cto.com/wyfs02/M00/07/F6/wKiom1nXQIChcyN2AACf_ Zqqe9g426.png-wh_500x0-wm_3-wmp_4-s_3796504730.png "alt=" Wkiom1nxqichcyn2aacf_zqqe9g426.png-wh_50 "/>

You can see that the cost of loading is much higher than uncompressed. Especially when the project is large. This is the meaning of compression js .....


This article is from the "Better_power_wisdom" blog, make sure to keep this source http://aonaufly.blog.51cto.com/3554853/1970528

Egret's Jszip Advanced application: Compression JS

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.