CN105224314A - A kind of method and system realizing front-end code Automatic Optimal - Google Patents
A kind of method and system realizing front-end code Automatic Optimal Download PDFInfo
- Publication number
- CN105224314A CN105224314A CN201510573611.XA CN201510573611A CN105224314A CN 105224314 A CN105224314 A CN 105224314A CN 201510573611 A CN201510573611 A CN 201510573611A CN 105224314 A CN105224314 A CN 105224314A
- Authority
- CN
- China
- Prior art keywords
- file
- resource
- module
- optimization
- css
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
- Document Processing Apparatus (AREA)
Abstract
The present invention relates to a kind of method and system realizing front-end code Automatic Optimal, comprise server end and pending resource file and demo file are carried out specific scanning; Described resource file is optimized process respectively; Described picture resource carries out the operations such as compression optimization rename respectively, and correspondence replaces all quoting in css and js, html file one by one; Described css, js resource carries out merging compression as required, in order, and replaces all quoting in html file one by one; Described redundant resource file is removed automatically; Quoting resource Automatic Optimal loading sequence in described html file; Final generation compressed package carries out version management; The present invention substantially increases front-end code quality, realizes resource and unifies Automatic Optimal, promotes the unified management of version, substantially increases development efficiency and greatly reduce the docking complexity with rear end developer.
Description
Technical field
The present invention relates to a kind of method and system realizing front-end code Automatic Optimal, belong to computer realm.
Background technology
In prior art, usually adopt manual mode to carry out resource file optimization in web front end code development process, manually carry out version management.Aforesaid operations method has following shortcoming: 1, code optimization result not necessarily unification, and 2, to repeat manual operation frequent, easily make mistakes, 3, html code content repeats to replace that workload is large, efficiency is low, and 4, version management disappearance.
Summary of the invention
Technical matters to be solved by this invention is, for the deficiency of prior art and flow process, provides a kind of method and system realizing front-end code Automatic Optimal that can improve front-end code quality.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of method realizing front-end code Automatic Optimal, specifically comprises the following steps:
Step 1: obtain the resource bundle that comprises multiple resources file;
Step 2: carry out autoscan to all resource files in described resource bundle, extracts wherein by the resource file used, is recorded as different array by by the resource file used respectively according to different classes of;
Step 3: carry out optimization of the same type and rename to different classes of array respectively, obtains and optimizes file;
Step 4: carry out multiple test to optimization file, and the report that outputs test result, according to test result report generation resource optimization scheme;
Step 5: remove redundant resource in resource bundle, calls resource optimization schemes generation mapping table, and the resource bundle after process is carried out compression generation resource compressed package;
Step 6: docked with Version by resource compressed package, realizes carrying out version management by mapping table.
The invention has the beneficial effects as follows: the present invention substantially increases front-end code quality, realize resource and unify Automatic Optimal, promote the unified management of version, substantially increase development efficiency and greatly reduce the docking complexity with rear end developer.
On the basis of technique scheme, the present invention can also do following improvement.
Further, the resource bundle in described step 1 comprises the resource file of the types such as css, js, html and image, and possesses specific directory hierarchy between described multiple resources file.
Further, described step 3 specifically comprises the following steps:
Step 3.1: judge whether it is the array of corresponding picture resource, if so, performs step 3.2; Otherwise, perform step 3.3;
Step 3.2: optimization of the same type is carried out and rename to described array; Replace quoting described picture in css, js, html;
Step 3.3: css, js file associated by scanning html file, and carry out merging compression with required in order, replace quoting css, js file in html file; And adjust the loading order of css and js, be optimized file.
Further, described optimization file bag html file, css file and js file.
Further, the test in described step 4 comprises normative testing, performance test and safety detection etc.
Further, the mapping table generated in described step 5 comprises buffer memory mapping table and resource mapping table etc.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of system realizing front-end code Automatic Optimal, comprises acquisition module, scan module, optimization module, test module, compression module and to connection module;
Described acquisition module is for obtaining the resource bundle that comprises multiple resources file;
Described scan module is used for carrying out autoscan to all resource files in described resource bundle, extracts wherein by the resource file used, is recorded as different array by by the resource file used respectively according to different classes of;
Described optimization module is used for carrying out optimization of the same type and rename to different classes of array respectively, obtains and optimizes file;
Described test module is used for carrying out multiple test to optimization file, and the report that outputs test result, according to test result report generation resource optimization scheme;
Described compression module is used for removing redundant resource in resource bundle, calls resource optimization schemes generation mapping table, and the resource bundle after process is carried out compression generation resource compressed package;
Described to connection module be used for resource compressed package is docked with Version, realize carrying out version management by mapping table.
The invention has the beneficial effects as follows: the present invention substantially increases front-end code quality, realize resource and unify Automatic Optimal, promote the unified management of version, substantially increase development efficiency and greatly reduce the docking complexity with rear end developer.
On the basis of technique scheme, the present invention can also do following improvement.
Further, the resource bundle in described acquisition module comprises the resource file of the types such as css, js, html and image, and possesses specific directory hierarchy between described multiple resources file.
Further, described optimization module comprises judge module, rename module and scanning replacement module;
Described judge module, for judging whether it is the array of corresponding picture resource, if so, triggers rename module; Otherwise, trigger sweep replacement module;
Described rename module is used for carrying out optimization of the same type and rename to described array; Replace quoting described picture in css, js, html;
Css, js file associated by described scanning replacement module scanning html file, and carry out merging compression with required in order, replace quoting css, js file in html file; And adjust the loading order of css and js, be optimized file.
Further, described optimization file bag html file, css file and js file.
Further, the test in described test module comprises normative testing, performance test and safety detection etc.
Further, the mapping table generated in described compression module comprises buffer memory mapping table and resource mapping table etc.
The present invention includes server end and pending resource file and demo file are carried out specific scanning; Described resource file is optimized process respectively; Described picture resource carries out the operations such as compression optimization rename respectively, and correspondence replaces all quoting in css and js, html file one by one; Described css, js resource carries out merging compression as required, in order, and replaces all quoting in html file one by one; Described redundant resource file is removed automatically; Quoting resource Automatic Optimal loading sequence in described html file; Final generation compressed package carries out version management.
Accompanying drawing explanation
Fig. 1 is a kind of method flow diagram realizing front-end code Automatic Optimal described in the embodiment of the present invention;
Fig. 2 is a kind of system architecture diagram realizing front-end code Automatic Optimal described in the embodiment of the present invention.
In accompanying drawing, the list of parts representated by each label is as follows:
1, acquisition module, 2, scan module, 3, optimize module, 4, test module, 5, compression module, 6, to connection module, 31, judge module, 32, rename module, 33, scanning replacement module.
Embodiment
Be described principle of the present invention and feature below in conjunction with accompanying drawing, example, only for explaining the present invention, is not intended to limit scope of the present invention.
As shown in Figure 1, be a kind of method realizing front-end code Automatic Optimal described in the embodiment of the present invention, specifically comprise the following steps:
Step 1: obtain the resource bundle that comprises multiple resources file;
Step 2: carry out autoscan to all resource files in described resource bundle, extracts wherein by the resource file used, is recorded as different array by by the resource file used respectively according to different classes of;
Step 3: judge whether it is the array of corresponding picture resource, if so, performs step 4; Otherwise, perform step 5;
Step 4: optimization of the same type is carried out and rename to described array; Replace quoting described picture in css, js, html;
Step 5: css, js file associated by scanning html file, and carry out merging compression with required in order, replace quoting css, js file in html file; And adjust the loading order of css and js, be optimized file;
Step 6: carry out multiple test to optimization file, and the report that outputs test result, according to test result report generation resource optimization scheme;
Step 7: remove redundant resource in resource bundle, calls resource optimization schemes generation mapping table, and the resource bundle after process is carried out compression generation resource compressed package;
Step 8: docked with Version by resource compressed package, realizes carrying out version management by mapping table.
Further, the resource bundle in described step 1 comprises the resource file of the types such as css, js, html and image, and possesses specific directory hierarchy between described multiple resources file.
Described optimization file bag html file, css file and js file.
Test in described step 6 comprises normative testing, performance test and safety detection etc.
The mapping table generated in described step 7 comprises buffer memory mapping table and resource mapping table etc.
As shown in Figure 2, be a kind of system realizing front-end code Automatic Optimal described in the embodiment of the present invention, comprise acquisition module 1, scan module 2, optimize module 3, test module 4, compression module 5 and to connection module 6;
Described acquisition module 1 is for obtaining the resource bundle that comprises multiple resources file;
Described scan module 2, for carrying out autoscan to all resource files in described resource bundle, extracts wherein by the resource file used, is recorded as different array by by the resource file used respectively according to different classes of;
Described optimization module 3, for carrying out optimization of the same type and rename to different classes of array respectively, obtains and optimizes file;
Described test module 4 is for carrying out multiple test to optimization file, and the report that outputs test result, according to test result report generation resource optimization scheme;
Described compression module 5, for removing redundant resource in resource bundle, calls resource optimization schemes generation mapping table, and the resource bundle after process is carried out compression generation resource compressed package;
Described to connection module 6 for resource compressed package is docked with Version, realize carrying out version management by mapping table.
Resource bundle in described acquisition module 1 comprises the resource file of the types such as css, js, html and image, and possesses specific directory hierarchy between described multiple resources file.
Described optimization module 3 comprises judge module 31, rename module 32 and scanning replacement module 33;
Described judge module 31, for judging whether it is the array of corresponding picture resource, if so, triggers rename module 32; Otherwise, trigger sweep replacement module 33;
Described rename module 32 is for carrying out optimization of the same type and rename to described array; Replace quoting described picture in css, js, html;
Described scanning replacement module 33 scans css, js file associated by html file, and carries out merging compression with required in order, replaces quoting css, js file in html file; And adjust the loading order of css and js, be optimized file.
Described optimization file bag html file, css file and js file.
Test in described test module 4 comprises normative testing, performance test and safety detection etc.
The mapping table generated in described compression module 5 comprises buffer memory mapping table and resource mapping table etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (10)
1. realize a method for front-end code Automatic Optimal, it is characterized in that, specifically comprise the following steps:
Step 1: obtain the resource bundle that comprises multiple resources file;
Step 2: carry out autoscan to all resource files in described resource bundle, extracts wherein by the resource file used, is recorded as different array by by the resource file used respectively according to different classes of;
Step 3: carry out optimization of the same type and rename to different classes of array respectively, obtains and optimizes file;
Step 4: carry out multiple test to optimization file, and the report that outputs test result, according to test result report generation resource optimization scheme;
Step 5: remove redundant resource in resource bundle, calls resource optimization schemes generation mapping table, and the resource bundle after process is carried out compression generation resource compressed package;
Step 6: docked with Version by resource compressed package, realizes carrying out version management by mapping table.
2. a kind of method realizing front-end code Automatic Optimal according to claim 1, it is characterized in that, resource bundle in described step 1 comprises the resource file of css, js, html and image type, and possesses specific directory hierarchy between described multiple resources file.
3. a kind of method realizing front-end code Automatic Optimal according to claim 1, it is characterized in that, described step 3 specifically comprises the following steps:
Step 3.1: judge whether it is the array of corresponding picture resource, if so, performs step 3.2; Otherwise, perform step 3.3;
Step 3.2: optimization of the same type is carried out and rename to described array; Replace quoting described picture in css, js, html;
Step 3.3: css, js file associated by scanning html file, and carry out merging compression with required in order, replace quoting css, js file in html file; And adjust the loading order of css and js, be optimized file.
4. a kind of method realizing front-end code Automatic Optimal according to any one of claim 1-3, is characterized in that, described optimization file comprises html file, css file and js file.
5. a kind of method realizing front-end code Automatic Optimal according to claim 4, it is characterized in that, the test in described step 4 comprises normative testing, performance test and safety detection.
6. a kind of method realizing front-end code Automatic Optimal according to claim 4, is characterized in that, the mapping table generated in described step 5 comprises buffer memory mapping table and resource mapping table.
7. realize a system for front-end code Automatic Optimal, it is characterized in that, comprise acquisition module, scan module, optimization module, test module, compression module and to connection module;
Described acquisition module is for obtaining the resource bundle that comprises multiple resources file;
Described scan module is used for carrying out autoscan to all resource files in described resource bundle, extracts wherein by the resource file used, is recorded as different array by by the resource file used respectively according to different classes of;
Described optimization module is used for carrying out optimization of the same type and rename to different classes of array respectively, obtains and optimizes file;
Described test module is used for carrying out multiple test to optimization file, and the report that outputs test result, according to test result report generation resource optimization scheme;
Described compression module is used for removing redundant resource in resource bundle, calls resource optimization schemes generation mapping table, and the resource bundle after process is carried out compression generation resource compressed package;
Described to connection module be used for resource compressed package is docked with Version, realize carrying out version management by mapping table.
8. a kind of system realizing front-end code Automatic Optimal according to claim 7, it is characterized in that, resource bundle in described acquisition module comprises the resource file of css, js, html and image type, and possesses specific directory hierarchy between described multiple resources file.
9. a kind of system realizing front-end code Automatic Optimal according to claim 7, is characterized in that, described optimization module comprises judge module, rename module and scanning replacement module;
Described judge module, for judging whether it is the array of corresponding picture resource, if so, triggers rename module; Otherwise, trigger sweep replacement module;
Described rename module is used for carrying out optimization of the same type and rename to described array; Replace quoting described picture in css, js, html;
Css, js file associated by described scanning replacement module scanning html file, and carry out merging compression with required in order, replace quoting css, js file in html file; And adjust the loading order of css and js, be optimized file.
10. a kind of system realizing front-end code Automatic Optimal according to any one of claim 7-9, is characterized in that, described optimization file bag html file, css file and js file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510573611.XA CN105224314B (en) | 2015-09-09 | 2015-09-09 | A kind of method and system for realizing front-end code Automatic Optimal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510573611.XA CN105224314B (en) | 2015-09-09 | 2015-09-09 | A kind of method and system for realizing front-end code Automatic Optimal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105224314A true CN105224314A (en) | 2016-01-06 |
CN105224314B CN105224314B (en) | 2018-07-17 |
Family
ID=54993311
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510573611.XA Active CN105224314B (en) | 2015-09-09 | 2015-09-09 | A kind of method and system for realizing front-end code Automatic Optimal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105224314B (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107291474A (en) * | 2017-06-23 | 2017-10-24 | 郑州云海信息技术有限公司 | A kind of front end engineering automates constructing system |
CN107577465A (en) * | 2017-09-21 | 2018-01-12 | 国云科技股份有限公司 | A kind of bearing calibration of web page code |
CN108241902A (en) * | 2016-12-23 | 2018-07-03 | 南京壹进制信息技术股份有限公司 | A kind of Web projects and performance optimization method |
CN108536463A (en) * | 2018-04-09 | 2018-09-14 | 深圳市腾讯网络信息技术有限公司 | Obtain method, apparatus, equipment and the computer readable storage medium of resource packet |
CN108959455A (en) * | 2018-06-15 | 2018-12-07 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Single page Web application implementation method, device, computer equipment and storage medium |
CN109344277A (en) * | 2018-08-31 | 2019-02-15 | 网易传媒科技(北京)有限公司 | Image processing method, device, medium and calculating equipment |
CN109558548A (en) * | 2017-09-25 | 2019-04-02 | 北京国双科技有限公司 | A kind of method and Related product for eliminating CSS style redundancy |
CN110704101A (en) * | 2019-09-06 | 2020-01-17 | 平安普惠企业管理有限公司 | Code file construction method, device, equipment and computer readable storage medium |
CN111506363A (en) * | 2020-04-21 | 2020-08-07 | 福建天晴在线互动科技有限公司 | Source code management method and system based on unity engine |
CN113835740A (en) * | 2021-11-29 | 2021-12-24 | 山东捷瑞数字科技股份有限公司 | Search engine optimization-oriented automatic front-end code repairing method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102799640B (en) * | 2012-06-27 | 2015-09-02 | 用友软件股份有限公司 | Page charger and page loading method |
CN104133685B (en) * | 2014-08-05 | 2017-10-31 | 广州唯品会网络技术有限公司 | The method and system of Website front-end exploitation |
CN104408178B (en) * | 2014-12-12 | 2018-10-16 | 用友网络科技股份有限公司 | WEB controls loading device and method |
-
2015
- 2015-09-09 CN CN201510573611.XA patent/CN105224314B/en active Active
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108241902A (en) * | 2016-12-23 | 2018-07-03 | 南京壹进制信息技术股份有限公司 | A kind of Web projects and performance optimization method |
CN107291474A (en) * | 2017-06-23 | 2017-10-24 | 郑州云海信息技术有限公司 | A kind of front end engineering automates constructing system |
CN107577465A (en) * | 2017-09-21 | 2018-01-12 | 国云科技股份有限公司 | A kind of bearing calibration of web page code |
CN107577465B (en) * | 2017-09-21 | 2021-04-27 | 国云科技股份有限公司 | Method for correcting webpage code |
CN109558548A (en) * | 2017-09-25 | 2019-04-02 | 北京国双科技有限公司 | A kind of method and Related product for eliminating CSS style redundancy |
CN109558548B (en) * | 2017-09-25 | 2021-05-25 | 北京国双科技有限公司 | Method for eliminating CSS style redundancy and related product |
CN108536463A (en) * | 2018-04-09 | 2018-09-14 | 深圳市腾讯网络信息技术有限公司 | Obtain method, apparatus, equipment and the computer readable storage medium of resource packet |
CN108959455A (en) * | 2018-06-15 | 2018-12-07 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Single page Web application implementation method, device, computer equipment and storage medium |
CN109344277B (en) * | 2018-08-31 | 2020-10-20 | 网易传媒科技(北京)有限公司 | Picture processing method, device, medium and computing equipment |
CN109344277A (en) * | 2018-08-31 | 2019-02-15 | 网易传媒科技(北京)有限公司 | Image processing method, device, medium and calculating equipment |
CN110704101A (en) * | 2019-09-06 | 2020-01-17 | 平安普惠企业管理有限公司 | Code file construction method, device, equipment and computer readable storage medium |
CN111506363A (en) * | 2020-04-21 | 2020-08-07 | 福建天晴在线互动科技有限公司 | Source code management method and system based on unity engine |
CN111506363B (en) * | 2020-04-21 | 2022-06-14 | 福建天晴在线互动科技有限公司 | Source code management method and system based on unity engine |
CN113835740A (en) * | 2021-11-29 | 2021-12-24 | 山东捷瑞数字科技股份有限公司 | Search engine optimization-oriented automatic front-end code repairing method |
Also Published As
Publication number | Publication date |
---|---|
CN105224314B (en) | 2018-07-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105224314A (en) | A kind of method and system realizing front-end code Automatic Optimal | |
CN103092761B (en) | Method and device of recognizing and checking modifying code blocks based on difference information file | |
CN110008195B (en) | Method, device and system for dynamically configuring html (hypertext markup language) to pdf (pdf) | |
CN1767453A (en) | Automatic test method and system | |
CN105718354A (en) | Fault information reproducing method and device | |
CN102187313A (en) | Caching runtime generated code | |
CN105022691A (en) | Highly automatic software testing method based on UML diagram | |
CN106101662A (en) | A kind of system and method utilizing bar code transmission data | |
CN104991860A (en) | WEB front-end automated development method and system | |
CN102207884A (en) | File compiling method and device | |
CN103914287A (en) | Plug-in mechanism based software system and implementation method thereof | |
CN109445771A (en) | A kind of off line network layers block code Auto-Generation Tool of CS framework and method | |
CN111898122B (en) | Log acquisition method and device for application in container, medium and electronic equipment | |
CN105183476A (en) | Cross-application program construction method and device | |
US20150317142A1 (en) | Colocation and anticolocation in colocation data centers via elastic nets | |
CN101388036A (en) | Data table summarizing method and device | |
CN103455392B (en) | A kind of virtual machine and across the data handling system of OS and method | |
CN104903865A (en) | Restoring a previous version of a virtual machine image | |
CN106446064A (en) | Data conversion method and device | |
CN101140506B (en) | Grating processing method and device | |
CN102819539A (en) | Repaid data type-in method and system | |
CN111880811A (en) | Method for realizing resource arrangement of cloud platform | |
CN104506630A (en) | Method, server and system for generating authority data on basis of user roles | |
CN102012816B (en) | Method and device for generating IDE engineering file and solution file | |
CN103167545B (en) | Be correlated with the method for IP cutover and device in a kind of base station |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |