[go: up one dir, main page]

CN109815455A - Item file treating method and apparatus - Google Patents

Item file treating method and apparatus Download PDF

Info

Publication number
CN109815455A
CN109815455A CN201910107812.9A CN201910107812A CN109815455A CN 109815455 A CN109815455 A CN 109815455A CN 201910107812 A CN201910107812 A CN 201910107812A CN 109815455 A CN109815455 A CN 109815455A
Authority
CN
China
Prior art keywords
file
item file
static resource
destination item
syntax tree
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
Application number
CN201910107812.9A
Other languages
Chinese (zh)
Other versions
CN109815455B (en
Inventor
董旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dongchezu Technology Co.,Ltd.
Original Assignee
Tianjin ByteDance Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tianjin ByteDance Technology Co Ltd filed Critical Tianjin ByteDance Technology Co Ltd
Priority to CN201910107812.9A priority Critical patent/CN109815455B/en
Publication of CN109815455A publication Critical patent/CN109815455A/en
Application granted granted Critical
Publication of CN109815455B publication Critical patent/CN109815455B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Present disclose provides a kind of item file treating method and apparatus, and wherein method includes: to carry out dissection process to pattern file each in destination item file, to obtain abstract syntax tree corresponding with destination item file;According to the attribute of each object in abstract syntax tree, each static resource that destination item file includes is determined;According to preset tupe, each static resource is handled, to obtain the corresponding static resource library of destination item file.This method is by analyzing the corresponding abstract syntax tree of item file, to obtain whole static resources that item file includes, and according to preset tupe, the static resource of acquisition is handled, all static resources in item file are subjected to unification to realize, so that when subsequent use static resource corresponding static resource can be obtained from the static resource library after integration, to reduce application and development cost, usage experience is improved.

Description

Item file treating method and apparatus
Technical field
This disclosure relates to technical field of data processing more particularly to a kind of item file treating method and apparatus.
Background technique
As status of the front-end technology in application and development is growing day by day, seem especially to the creation and maintenance of application and development It is important.
In practical application development process, developer would generally define different files, and by the various resources of application File is stored in corresponding file, so as to later period use.However, with the continuous refinement of application runtime environment, application function mould The division of block is also increasingly thinner, so that can have multiple and different file packets in an application item, and different file packets In again there are independent static resources.Since each independent file packet may use different strapping tools or language editor Device increases application and development cost so that the integration of the static resource in different file packets becomes to become increasingly complex.Thus, urgently A kind of integrated scheme for simplifying static resource in different file packets is needed, to reduce application and development cost.
Summary of the invention
The disclosure provides a kind of item file treating method and apparatus, needs a kind of simplification in the related technology for solving The integrated scheme of static resource in different file packets, the problem of to reduce application and development cost.
Disclosure one side embodiment provides a kind of item file processing method, this method comprises: to destination item file In each pattern file carry out dissection process, to obtain abstract syntax tree corresponding with the destination item file;According to the pumping As the attribute of each object in syntax tree, each static resource that the destination item file includes is determined;According to preset place Reason mode handles each static resource, to obtain the corresponding static resource library of the destination item file.
Disclosure another aspect embodiment provides a kind of item file processing unit, which includes: the first acquisition module, It is corresponding with the destination item file abstract to obtain for carrying out dissection process to pattern file each in destination item file Syntax tree;Determining module determines the destination item file for the attribute according to each object in the abstract syntax tree Each static resource for including;Second obtains module, is used for according to preset tupe, at each static resource Reason, to obtain the corresponding static resource library of the destination item file.
The another aspect embodiment of the disclosure provides a kind of electronic equipment, which includes memory, processor and deposit Storage on a memory and the computer program that can run on a processor, when the processor execution described program, to realize the Item file processing method described in one side embodiment.
The computer readable storage medium of disclosure another further aspect embodiment, is stored thereon with computer program, the calculating When machine program is executed by processor, to realize item file processing method described in first aspect embodiment.
Technical solution disclosed in the disclosure, has the following beneficial effects:
By carrying out dissection process to pattern file each in destination item file, pumping corresponding with destination item file is obtained As syntax tree, and according to the attribute of each object in abstract syntax tree, each static resource that destination item file includes is determined, Then according to preset tupe, each static resource is handled, to obtain the corresponding static resource of destination item file Library.As a result, by analyzing the corresponding abstract syntax tree of item file, to obtain all static money that item file includes Source, and according to preset tupe, the static resource of acquisition is handled, to realize all static state in item file Resource carries out unification, so that can obtain corresponding static money from the static resource library after integration when subsequent use static resource Usage experience is improved to reduce application and development cost in source.
The additional aspect of the disclosure and advantage will be set forth in part in the description, and will partially become from the following description It obtains obviously, or recognized by the practice of the disclosure.
Detailed description of the invention
The disclosure is above-mentioned and/or additional aspect and advantage will become from the following description of the accompanying drawings of embodiments Obviously and it is readily appreciated that, wherein
Fig. 1 is the flow diagram for implementing the item file processing method exemplified according to the disclosure one;
Fig. 2 is the flow diagram according to another item file processing method for implementing to exemplify of the disclosure;
Fig. 3 is the flow diagram according to the another item file processing method for implementing to exemplify of the disclosure;
Fig. 4 is the structural schematic diagram according to the item file processing unit shown in an embodiment of the present disclosure;
Fig. 5 is that another implements the structural schematic diagram of the item file processing unit exemplified according to the disclosure;
Fig. 6 is that another implements the structural schematic diagram of the item file processing unit exemplified according to the disclosure;
Fig. 7 is the structural schematic diagram for implementing the electronic equipment exemplified according to the disclosure one.
Specific embodiment
Embodiment of the disclosure is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached The embodiment of figure description is exemplary, it is intended to for explaining the disclosure, and should not be understood as the limitation to the disclosure.
Each embodiment of the disclosure needs a kind of integration side for simplifying static resource in different file packets in the related technology Case the problem of to reduce application and development cost, proposes a kind of item file processing method.
The embodiment of the present disclosure, by carrying out dissection process, acquisition and target item to pattern file each in destination item file The corresponding abstract syntax tree of mesh file, and according to the attribute of each object in abstract syntax tree, determine destination item file packet It is corresponding to obtain destination item file to handle each static resource according to preset processing mode for each static resource contained Static resource library.As a result, by analyzing the corresponding abstract syntax tree of item file, include to obtain item file Whole static resources, and according to preset tupe, the static resource of acquisition is handled, it will be in item file with realization All static resources carry out unification so that it is subsequent using static resource when, can be obtained from the static resource library after integration pair The static resource answered improves usage experience to reduce application and development cost.
Below with reference to the accompanying drawings the item file treating method and apparatus of the embodiment of the present disclosure is described.
Fig. 1 is combined first, and in the embodiment of the present disclosure, item file processing method is specifically described.Fig. 1 is according to this The flow diagram for the item file processing method that one implementation exemplifies is disclosed.
As described in Figure 1, item file processing method may comprise steps of:
Step 101, dissection process is carried out to pattern file each in destination item file, to obtain and destination item file pair The abstract syntax tree answered.
Wherein, the item file processing method that the embodiment of the present disclosure provides, the electronics that can be provided by the embodiment of the present disclosure Equipment executes.Wherein, it is provided with item file processing unit in electronic equipment, item file treatment process is controlled with realizing System.In the present embodiment, electronic equipment can be any hardware device, such as computer having data processing function etc..
In the present embodiment, destination item file refers to be processed using corresponding project file.
Wherein, pattern file refers to cascading style sheets (Cascading Style Sheets, abbreviation CSS) file.In reality In the application of border, in CSS file can include: the resources such as picture, font, color.
Optionally, the present embodiment can parse pattern file each in destination item file by PostCSS processor Processing obtains abstract syntax tree (Abstract Syntax Tree, abbreviation AST) corresponding with destination item file.
Wherein, PostCSS itself is the relatively simple tool of a function.It provides a kind of mode JavaScript Code handles CSS file, is responsible for CSS code analysis into abstract syntax tree construction, then transfer to plug-in unit to be handled.
It should be noted that the embodiment of the present application to the form of the abstract syntax tree of acquisition without limitation, for example can be The abstract syntax tree of " tree " type structure, or it is also possible to form as shown in table 1 below.
Table 1:
CSS language JavaScript object
@charset"UTF-8 AtRule (@grammer in mark CSS)
/*comment*/ Comment (is annotated) in mark CSS
color:black Rule (single attribute in mark CSS)
As shown in Table 1 above, the first column is the language in destination item file, and the second column is the abstract syntax tree after conversion In object.
Step 102, according to the attribute of each object in abstract syntax tree, each static state that destination item file includes is determined Resource.
Wherein it is determined that abstract syntax tree corresponding with destination item file in, including each object and its corresponding category Property information, such as table 1 in " Comment " object, attribute information be " being annotated in CSS ", that is, show the object be CSS file In certain an object.In turn, electronic equipment can be analyzed by the attribute to object each in abstract syntax tree, determine target Each static resource that item file includes.
Further, when the present embodiment determines each static resource that destination item file includes, can also include:
Judge whether the attribute of each object in abstract syntax tree matches with preset decimation rule;
If the attribute of the first object is matched with preset decimation rule, it is determined that the first object is in destination item file One static resource.
Wherein, preset decimation rule can be what pre-set or developer was rule of thumb arranged, herein It is not especially limited.
For example, if preset decimation rule are as follows: color, then when electronic equipment is to the category of object each in abstract syntax tree Property when being analyzed, if the attribute of third object is black, it is determined that the attribute of third object and preset decimation rule Match, then the static resource that third object can be determined as in destination item file.
Step 103, according to preset tupe, each static resource is handled, to obtain destination item file pair The static resource library answered.
Wherein, preset tupe can be pre-set or developer according to suitable using scene The setting of answering property, it is not especially limited herein.
For example, if preset tupe are as follows: when handling static resource using the mode of copy, then electronic equipment can will be each Static resource copies under preassigned catalogue, obtains corresponding static resource library.
It is understood that the present embodiment by utilize PostCSS processor, by pattern file each in destination item file It is parsed into abstract syntax tree construction, to determine that destination item file includes according to the attribute of object each in abstract syntax tree Each static resource is handled each static resource then according to preset tupe, obtains corresponding static resource library, So that can be obtained directly in static resource library when the subsequent static resource for including using destination item file, so as to To simplify the integrated operation of static resource in item file, and the subsequent static resource using after integration can also be facilitated, improved Application and development speed.
The item file processing method that the embodiment of the present disclosure provides, by being carried out to pattern file each in destination item file Dissection process obtains abstract syntax tree corresponding with destination item file, and according to the category of each object in abstract syntax tree Property, each static resource that destination item file includes is determined, then according to preset tupe, at each static resource Reason, to obtain the corresponding static resource library of destination item file.As a result, by being carried out to the corresponding abstract syntax tree of item file Analysis, to obtain whole static resources that item file includes, and according to preset tupe, to the static resource of acquisition into All static resources in item file are carried out unification to realize by row processing so that it is subsequent using static resource when, can be from whole Corresponding static resource is obtained in static resource library after conjunction, to reduce application and development cost, improves usage experience.
By above-mentioned analysis it is found that the embodiment of the present disclosure can be by according to abstract syntax corresponding with destination item file Tree, determines each static resource that destination item file includes, and handle each static resource, obtains destination item file pair The static resource library answered.
During specific implementation, the disclosure before each pattern file progress dissection process, is gone back in destination item file It can determine target patterns file to be processed according to pattern file identification collection, then determining target patterns file is solved Analysis processing, improves processing speed.Below with reference to Fig. 2, to the above situation of the item file processing method of the embodiment of the present disclosure into Row illustrates.
Fig. 2 is the flow diagram according to another item file processing method for implementing to exemplify of the disclosure.Such as Fig. 2 institute Show, the item file processing method of the embodiment of the present disclosure may comprise steps of:
Step 201, according to the pattern file identification collection of acquisition, each pattern file in destination item file is screened Processing, to determine target patterns file to be processed in destination item file.
In the present embodiment, pattern file identification collection can be the identification sets that developer specifies in application development process, It is also possible to preset etc..
That is, the disclosure is by screening each pattern file, determining wait locate according to sample file identification sets The target patterns file of reason, so that electronic equipment is when handling item file, only to target patterns file to be processed It is handled, without handling other pattern files, so as to improve the processing speed of item file.
Step 202, dissection process is carried out to each target patterns file in destination item file, with acquisition and destination item The corresponding abstract syntax tree of file.
Wherein, it when carrying out dissection process to each target patterns file in destination item file, can be handled by PostCSS Device carries out dissection process to target patterns file each in destination item file, corresponding with destination item file abstract to obtain Syntax tree.
Step 203, according to the attribute of each object in abstract syntax tree, each static state that destination item file includes is determined Resource.
Step 204, according to preset tupe, each static resource is handled, to obtain destination item file pair The static resource library answered.
The realization principle and process of step 203- step 204, in above-described embodiment step 102- step 103 it is similar, For details, reference can be made to above-described embodiments, do not repeat excessively it herein.
The item file processing method that the embodiment of the present disclosure provides, by the pattern file identification collection according to acquisition, to mesh It marks each pattern file in item file and carries out Screening Treatment, to determine target patterns file to be processed in destination item file, And dissection process is carried out to each target patterns file in destination item file, obtain abstract language corresponding with destination item file Method tree determines each static resource that destination item file includes, then root according to the attribute of each object in abstract syntax tree According to preset tupe, each static resource is handled, to obtain the corresponding static resource library of destination item file.By This, so that electronic equipment when handling item file, is only handled target patterns file to be processed, nothing Other pattern files need to be handled, to improve the processing speed of item file, shorten the application and development period.
By above-mentioned analysis it is found that the embodiment of the present disclosure is according to pattern file identification collection, determine in destination item file to The target patterns file of processing obtains pumping corresponding with destination item file to carry out dissection process to each target patterns file As syntax tree, and according to abstract syntax tree, each static resource that destination item file includes is determined, and carry out to each static resource Processing obtains the corresponding static resource library of destination item file.
It realizes in scene in another kind, before the disclosure handles each static resource, can also be set according to tupe Each configuration parameter inputted in the page is set, determines preset tupe, with according to preset tupe, to each static resource It is handled.Below with reference to Fig. 3, the above situation of the item file processing method of the embodiment of the present disclosure is specifically described.
Fig. 3 is the flow diagram according to the another item file processing method for implementing to exemplify of the disclosure.Such as Fig. 3 institute Show, the item file processing method of the embodiment of the present disclosure may comprise steps of:
Wherein, step 301- step 302 is identical as step 101- step 102, can refer to embodiment described in Fig. 1.
Step 303, each configuration parameter inputted in the page is set according to tupe, determines preset tupe.
Step 304, according to preset tupe, each static resource is handled, to obtain destination item file pair The static resource library answered.
In the present embodiment, the configuration parameter being arranged in the page includes at least one of following parameter: static resource Processing mode, the output directory of static resource, the corresponding new resources catalogue of each pattern file, the class of static resource to be processed Type, target patterns file and non-targeted pattern file.
Wherein, each configuration parameter refers to developer in application development process, according to the setting of the usage scenario of application Different configuration parameters.
For example, as shown in table 2, developer can be arranged in the page in tupe inputs different configuration parameters, with right CSS file carries out different processing.
Wherein, first parameter type is classified as in table 2, second is classified as the corresponding processing mode description of the parameter.It needs to illustrate , configuration parameter and description in table 2 only schematically illustrate, and those skilled in the art can according to need, and carry out any Expansion or definition, the present embodiment do not limit this.
Table 2:
As shown in table 2, electronic equipment each configuration parameter that not only available developer inputs, can also obtain and respectively match The description information of parameter is set, so that electronic equipment according to the configuration parameter got, that is, can determine preset tupe.
For example, when the configuration parameter inputted in the tupe setting page are as follows: when extensions, then electronic equipment can be true Fixed preset tupe are as follows: pass through the what type of static resource of suffix name definition process.
In turn, using preset tupe, each static resource is handled, it is corresponding to obtain destination item file Static resource library.
Step 305, according to the output directory of static resource, static resource library is exported.
After handling each static resource, electronic equipment can according to the output directory of static resource, such as: AssetsPath exports static resource library.
Step 306, it according to the corresponding new resources catalogue of each pattern file, updates in destination item file in each pattern file Resource TOC.
The item file processing method that the embodiment of the present disclosure provides, according to the attribute of each object in abstract syntax tree, It determines each static resource that destination item file includes, and each configuration parameter inputted in the page is set according to tupe, really Fixed preset tupe is handled each static resource then according to preset tupe, to obtain destination item text The corresponding static resource library of part exports static resource library according to the output directory of static resource, and corresponding according to each pattern file New resources catalogue, update the Resource TOC in destination item file in each pattern file.Hereby it is achieved that being joined according to each configuration Number, determines corresponding tupe, flexibly to be handled each static resource, and also to pattern file each in item file In Resource TOC be updated, matched with ensuring in each pattern file resource object with actual conditions.
To achieve the goals above, the disclosure also proposed a kind of item file processing unit.
Fig. 4 is the structural schematic diagram according to the item file processing unit shown in an embodiment of the present disclosure.Such as Fig. 4 institute Show, the item file processing unit of the embodiment of the present disclosure includes: the first acquisition module 11, determining module 12 and the second acquisition module 13。
Wherein, first module 11 is obtained for carrying out dissection process to pattern file each in destination item file, to obtain Abstract syntax tree corresponding with the destination item file;
Determining module 12 is used for the attribute according to each object in the abstract syntax tree, determines the destination item text Each static resource that part includes;
Second, which obtains module 13, is used to handle each static resource according to preset tupe, to obtain The corresponding static resource library of the destination item file.
Optionally, in an optional implementation of the disclosure, the determining module 12 includes:
Judging unit, for judge each object in the abstract syntax tree attribute whether with preset decimation rule Match;
Determination unit, if the attribute for the first object is matched with the preset decimation rule, it is determined that described first Object is a static resource in the destination item file.
It should be noted that the aforementioned explanation to item file processing method embodiment is also applied for the embodiment Item file processing unit, realization principle is similar, and details are not described herein again.
The item file processing unit that the embodiment of the present disclosure provides, by being carried out to pattern file each in destination item file Dissection process obtains abstract syntax tree corresponding with destination item file, and according to the category of each object in abstract syntax tree Property, each static resource that destination item file includes is determined, then according to preset tupe, at each static resource Reason, to obtain the corresponding static resource library of destination item file.As a result, by being carried out to the corresponding abstract syntax tree of item file Analysis, to obtain whole static resources that item file includes, and according to preset tupe, to the static resource of acquisition into All static resources in item file are carried out unification to realize by row processing so that it is subsequent using static resource when, can be from whole Corresponding static resource is obtained in static resource library after conjunction, to reduce application and development cost, improves usage experience.
Fig. 5 is that another implements the structural schematic diagram of the item file processing unit exemplified according to the disclosure.Such as Fig. 5 institute Show, the item file processing unit of the embodiment of the present disclosure includes: the first acquisition module 11, the acquisition module of determining module 12, second 13, screening module 14.
Wherein, first module 11 is obtained for carrying out dissection process to pattern file each in destination item file, to obtain Abstract syntax tree corresponding with the destination item file;
Determining module 12 is used for the attribute according to each object in the abstract syntax tree, determines the destination item text Each static resource that part includes;
Second, which obtains module 13, is used to handle each static resource according to preset tupe, to obtain The corresponding static resource library of the destination item file.
Optionally, in an optional implementation of the disclosure, screening module 14 is used for the pattern text according to acquisition Part identification sets carry out Screening Treatment to each pattern file in the destination item file, with the determination destination item file In target patterns file to be processed;
The first acquisition module 11 is also used to parse each target patterns file in the destination item file Processing.
It should be noted that the aforementioned explanation to item file processing method embodiment is also applied for the embodiment Item file processing unit, realization principle is similar, and details are not described herein again.
The item file processing unit that the embodiment of the present disclosure provides, by the pattern file identification collection according to acquisition, to mesh It marks each pattern file in item file and carries out Screening Treatment, to determine target patterns file to be processed in destination item file, And dissection process is carried out to each target patterns file in destination item file, obtain abstract language corresponding with destination item file Method tree determines each static resource that destination item file includes, then root according to the attribute of each object in abstract syntax tree According to preset tupe, each static resource is handled, to obtain the corresponding static resource library of destination item file.By This, so that electronic equipment when handling item file, is only handled target patterns file to be processed, nothing Other pattern files need to be handled, to improve the processing speed of item file, shorten the application and development period.
Fig. 6 is that another implements the structural schematic diagram of the item file processing unit exemplified according to the disclosure.Such as Fig. 6 institute Show, the item file processing unit of the embodiment of the present disclosure includes: the first acquisition module 11, the acquisition module of determining module 12, second 13, the second determining module 15, output module 16, update module 17.
Wherein, first module 11 is obtained for carrying out dissection process to pattern file each in destination item file, to obtain Abstract syntax tree corresponding with the destination item file;
Determining module 12 is used for the attribute according to each object in the abstract syntax tree, determines the destination item text Each static resource that part includes;
Second, which obtains module 13, is used to handle each static resource according to preset tupe, to obtain The corresponding static resource library of the destination item file.
Optionally, in an optional implementation of the disclosure, the second determining module 15 is used for according to tupe Each configuration parameter inputted in the page is set, determines the preset tupe.
Optionally, in an optional implementation of the disclosure, it is described setting the page in configuration parameter include with Under at least one of each parameter: the processing mode of static resource, the output directory of static resource, each pattern file are corresponding new Resource TOC, the type of static resource to be processed, target patterns file and non-targeted pattern file.
Output module 16 is used for the output directory according to the static resource, exports the static resource library
Update module 17 is used to update the destination item file according to the corresponding new resources catalogue of each pattern file In Resource TOC in each pattern file.
It should be noted that the aforementioned explanation to item file processing method embodiment is also applied for the embodiment Item file processing unit, realization principle is similar, and details are not described herein again.
The item file processing unit that the embodiment of the present disclosure provides, according to the attribute of each object in abstract syntax tree, It determines each static resource that destination item file includes, and each configuration parameter inputted in the page is set according to tupe, really Fixed preset tupe is handled each static resource then according to preset tupe, to obtain destination item text The corresponding static resource library of part exports static resource library according to the output directory of static resource, and corresponding according to each pattern file New resources catalogue, update the Resource TOC in destination item file in each pattern file.Hereby it is achieved that being joined according to each configuration Number, determines corresponding tupe, flexibly to be handled each static resource, and also to pattern file each in item file In Resource TOC be updated, matched with ensuring in each pattern file resource object with actual conditions.
In order to realize above-described embodiment, the disclosure also proposes a kind of electronic equipment.
Fig. 7 is the structural schematic diagram for implementing the electronic equipment exemplified according to the disclosure one.
Below with reference to Fig. 7, it illustrates the structural representations for the electronic equipment 800 for being suitable for being used to realize the embodiment of the present disclosure Figure.Electronic equipment in the embodiment of the present disclosure can include but is not limited to such as mobile phone, laptop, PDA (a number Word assistant), the fixed terminal of the mobile terminal of PAD (tablet computer) etc. and such as desktop computer etc..Shown in Fig. 7 Electronic equipment is only an example, should not function to the embodiment of the present disclosure and use scope bring any restrictions.
As shown in fig. 7, electronic equipment 800 may include processing unit (such as central processing unit, graphics processor etc.) 801, random access can be loaded into according to the program being stored in read-only memory (ROM) 802 or from storage device 808 Program in memory (RAM) 803 and execute various movements appropriate and processing.In RAM 803, it is also stored with electronic equipment Various programs and data needed for 800 operations.Processing unit 801, ROM 802 and RAM 803 pass through the phase each other of bus 804 Even.Input/output (I/O) interface 805 is also connected to bus 804.
In general, following device can connect to I/O interface 805: including such as touch screen, touch tablet, keyboard, mouse, taking the photograph As the input unit 806 of head, microphone, accelerometer, gyroscope etc.;Including such as liquid crystal display (LCD), loudspeaker, vibration The output device 807 of dynamic device etc.;Storage device 808 including such as tape, hard disk etc.;And communication device 809.Communication device 809, which can permit electronic equipment 800, is wirelessly or non-wirelessly communicated with other equipment to exchange data.Although Fig. 7 shows tool There is the electronic equipment 800 of various devices, it should be understood that being not required for implementing or having all devices shown.It can be with Alternatively implement or have more or fewer devices.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium On computer program, which includes the program code for method shown in execution flow chart.In such reality It applies in example, which can be downloaded and installed from network by communication device 809, or from storage device 808 It is mounted, or is mounted from ROM 802.When the computer program is executed by processing unit 801, the embodiment of the present disclosure is executed Method in the above-mentioned function that limits.
It should be noted that the implementation process and technical principle of the electronic equipment of the present embodiment are referring to aforementioned to first aspect The explanation of the item file processing method of embodiment, details are not described herein again.
The electronic equipment that the embodiment of the present disclosure provides, by being carried out at parsing to pattern file each in destination item file Reason obtains abstract syntax tree corresponding with destination item file, and according to the attribute of each object in abstract syntax tree, determines Each static resource that destination item file includes is handled each static resource then according to preset tupe, to obtain Take the corresponding static resource library of destination item file.As a result, by analyzing the corresponding abstract syntax tree of item file, with Whole static resources that item file includes are obtained, and according to preset tupe, the static resource of acquisition is handled, All static resources in item file are subjected to unification to realize, so that when subsequent use static resource, it can be after integration Corresponding static resource is obtained in static resource library, to reduce application and development cost, improves usage experience.
To achieve the above object, the disclosure also proposes a kind of computer readable storage medium.
The wherein computer readable storage medium, is stored thereon with computer program, when which is executed by processor, with Realize item file processing method described in first aspect embodiment.
In a kind of optional way of realization, the present embodiment can be using any group of one or more computer-readable media It closes.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readable to deposit Storage media for example may be-but not limited to-system, device or the device of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor Part, or any above combination.The more specific example (non exhaustive list) of computer readable storage medium includes: to have The electrical connection of one or more conducting wires, portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD- ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this document, computer-readable storage Medium can be any tangible medium for including or store program, which can be commanded execution system, device or device Using or it is in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including --- but It is not limited to --- electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be Any computer-readable medium other than computer readable storage medium, which can send, propagate or Transmission is for by the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited In --- wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof Program code, described program design language include object oriented program language-such as Java, Smalltalk, C++, Further include conventional procedural programming language-such as " C " language or similar programming language.Program code can be with It fully executes, partly execute on the user computer on the user computer, being executed as an independent software package, portion Divide and partially executes or executed on a remote computer or server completely on the remote computer on the user computer.? Be related in the situation of remote computer, remote computer can pass through the network of any kind --- including local area network (LAN) or Wide area network (WAN)-be connected to subscriber computer, or, it may be connected to outer computer (such as mentioned using Internet service It is connected for quotient by internet).
To achieve the above object, the disclosure also proposes a kind of computer program.Wherein when computer program is held by processor When row, to realize item file processing method described in first aspect embodiment.
In the disclosure unless specifically defined or limited otherwise, the terms such as term " setting ", " connection " should do broad sense reason Solution, for example, it may be mechanical connection, is also possible to be electrically connected;It can be directly connected, the indirect phase of intermediary can also be passed through Even, the connection inside two elements or the interaction relationship of two elements be can be, unless otherwise restricted clearly.For this For the those of ordinary skill in field, the concrete meaning of above-mentioned term in the disclosure can be understood as the case may be.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show The description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or example Point is contained at least one embodiment or example of the disclosure.
In addition, term " first ", " second " are used for descriptive purposes only and cannot be understood as indicating or suggesting relative importance Or implicitly indicate the quantity of indicated technical characteristic.Define " first " as a result, the feature of " second " can be expressed or Implicitly include at least one this feature.
Any process described otherwise above or method description are construed as in flow chart or herein, and expression includes It is one or more for realizing specific logical function or process the step of executable instruction code module, segment or portion Point, and the range of the preferred embodiment of the disclosure includes other realization, wherein can not press shown or discussed suitable Sequence, including according to related function by it is basic simultaneously in the way of or in the opposite order, Lai Zhihang function, this should be by the disclosure Embodiment person of ordinary skill in the field understood.
It should be appreciated that each section of the disclosure can be realized with hardware, software, firmware or their combination.Above-mentioned In embodiment, software that multiple steps or method can be executed in memory and by suitable instruction execution system with storage Or firmware is realized.It, and in another embodiment, can be under well known in the art for example, if realized with hardware Any one of column technology or their combination are realized: having a logic gates for realizing logic function to data-signal Discrete logic, with suitable combinational logic gate circuit specific integrated circuit, programmable gate array (PGA), scene Programmable gate array (FPGA) etc..
Those skilled in the art are understood that realize all or part of step that above-described embodiment method carries It suddenly is that relevant hardware can be instructed to complete by program, the program can store in a kind of computer-readable storage medium In matter, which when being executed, includes the steps that one or a combination set of embodiment of the method.
Storage medium mentioned above can be read-only memory, disk or CD etc..Although having been shown and retouching above Embodiment of the disclosure is stated, it is to be understood that above-described embodiment is exemplary, and should not be understood as the limit to the disclosure System, those skilled in the art can be changed above-described embodiment, modify, replace and become within the scope of this disclosure Type.

Claims (10)

1. a kind of item file processing method characterized by comprising
Dissection process is carried out to pattern file each in destination item file, it is corresponding with the destination item file abstract to obtain Syntax tree;
According to the attribute of each object in the abstract syntax tree, each static money that the destination item file includes is determined Source;
According to preset tupe, each static resource is handled, it is corresponding to obtain the destination item file Static resource library.
2. the method as described in claim 1, which is characterized in that the category according to each object in the abstract syntax tree Property, determine each static resource that the destination item file includes, comprising:
Judge whether the attribute of each object in the abstract syntax tree matches with preset decimation rule;
If the attribute of the first object is matched with the preset decimation rule, it is determined that first object is the destination item A static resource in file.
3. the method as described in claim 1, which is characterized in that it is described according to preset tupe, to each static money Before source is handled, further includes:
Each configuration parameter inputted in the page is set according to tupe, determines the preset tupe.
4. method as claimed in claim 3, which is characterized in that the configuration parameter in the setting page includes following parameter At least one of: the processing mode of static resource, the output directory of static resource, the corresponding new resources mesh of each pattern file Record, the type of static resource to be processed, target patterns file and non-targeted pattern file.
5. method as claimed in claim 4, which is characterized in that described to obtain the corresponding static resource of the destination item file After library, further includes:
According to the output directory of the static resource, the static resource library is exported;
According to the corresponding new resources catalogue of each pattern file, the money in the destination item file in each pattern file is updated Source directory.
6. method a method as claimed in any one of claims 1 to 5, which is characterized in that it is described to pattern file each in destination item file into Before row dissection process, further includes:
According to the pattern file identification collection of acquisition, Screening Treatment is carried out to each pattern file in the destination item file, with Determine target patterns file to be processed in the destination item file;
It is described that dissection process is carried out to pattern file each in destination item file, comprising:
Dissection process is carried out to each target patterns file in the destination item file.
7. a kind of item file processing unit characterized by comprising
First obtains module, for carrying out dissection process to pattern file each in destination item file, to obtain and the target The corresponding abstract syntax tree of item file;
Determining module determines the destination item file packet for the attribute according to each object in the abstract syntax tree Each static resource contained;
Second obtains module, for handling each static resource, to obtain the mesh according to preset tupe Mark the corresponding static resource library of item file.
8. device as claimed in claim 7, which is characterized in that the determining module, comprising:
Judging unit, for judging whether the attribute of each object in the abstract syntax tree matches with preset decimation rule;
Determination unit, if the attribute for the first object is matched with the preset decimation rule, it is determined that first object For a static resource in the destination item file.
9. a kind of electronic equipment, which is characterized in that on a memory and can be on a processor including memory, processor and storage The computer program of operation, when the processor executes described program, to realize the project text as described in claim 1-6 is any Part processing method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor When execution, to realize the item file processing method as described in claim 1-6 is any.
CN201910107812.9A 2019-02-02 2019-02-02 Project file processing method and device Active CN109815455B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910107812.9A CN109815455B (en) 2019-02-02 2019-02-02 Project file processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910107812.9A CN109815455B (en) 2019-02-02 2019-02-02 Project file processing method and device

Publications (2)

Publication Number Publication Date
CN109815455A true CN109815455A (en) 2019-05-28
CN109815455B CN109815455B (en) 2023-05-05

Family

ID=66605214

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910107812.9A Active CN109815455B (en) 2019-02-02 2019-02-02 Project file processing method and device

Country Status (1)

Country Link
CN (1) CN109815455B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704053A (en) * 2019-09-03 2020-01-17 五八有限公司 Method and device for processing style information
CN111897989A (en) * 2020-07-29 2020-11-06 北京字节跳动网络技术有限公司 Image processing method and device, terminal and storage medium
CN112463152A (en) * 2020-12-09 2021-03-09 深圳赛安特技术服务有限公司 Webpage adaptation method and device based on AST
CN117251421A (en) * 2023-09-04 2023-12-19 网易(杭州)网络有限公司 File processing method, device, storage medium and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9026903B1 (en) * 2011-01-11 2015-05-05 Google Inc. Abstract syntax tree interpreter for generating a valid HTML document
CN106547749A (en) * 2015-09-16 2017-03-29 北京国双科技有限公司 The method and apparatus of collecting webpage data
CN107861868A (en) * 2017-10-31 2018-03-30 郑州云海信息技术有限公司 A kind of method and system for extracting automation test object
CN108446136A (en) * 2018-03-22 2018-08-24 北京焦点新干线信息技术有限公司 A kind of extracting method and system of element code

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9026903B1 (en) * 2011-01-11 2015-05-05 Google Inc. Abstract syntax tree interpreter for generating a valid HTML document
CN106547749A (en) * 2015-09-16 2017-03-29 北京国双科技有限公司 The method and apparatus of collecting webpage data
CN107861868A (en) * 2017-10-31 2018-03-30 郑州云海信息技术有限公司 A kind of method and system for extracting automation test object
CN108446136A (en) * 2018-03-22 2018-08-24 北京焦点新干线信息技术有限公司 A kind of extracting method and system of element code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
潇湘待雨: "更便捷的css处理方式-PostCSS", 《博客园,HTTPS://WWW.CNBLOGS.COM/PQJWYN/P/8059939.HTML》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704053A (en) * 2019-09-03 2020-01-17 五八有限公司 Method and device for processing style information
CN111897989A (en) * 2020-07-29 2020-11-06 北京字节跳动网络技术有限公司 Image processing method and device, terminal and storage medium
CN112463152A (en) * 2020-12-09 2021-03-09 深圳赛安特技术服务有限公司 Webpage adaptation method and device based on AST
CN117251421A (en) * 2023-09-04 2023-12-19 网易(杭州)网络有限公司 File processing method, device, storage medium and electronic device

Also Published As

Publication number Publication date
CN109815455B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
CN109634598B (en) Page display method, device, equipment and storage medium
EP4046000B1 (en) Methods and systems for integrated development environment editor support with a single code base
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
CN113031946B (en) Method and device for rendering page component
CN114035879B (en) Page theme color replacement method, device, electronic equipment and computer readable medium
CN103853535B (en) The method and apparatus for changing middleware
CN113407165B (en) SDK generation and self-upgrade method, device, readable medium and equipment
CN109815455A (en) Item file treating method and apparatus
CN113391811B (en) Function compiling method, function compiling device, electronic equipment and computer readable storage medium
US20240303413A1 (en) Document editing method and apparatus, and terminal and non-transitory storage medium
CN109582317A (en) Method and apparatus for debugging boarding application
CN109947431A (en) A kind of code generating method, device, equipment and storage medium
CN108959294A (en) A kind of method and apparatus accessing search engine
WO2024152665A1 (en) Code construction method and apparatus, and computer device and storage medium
WO2019029451A1 (en) Method for publishing mobile applications and electronic apparatus
CN110780874B (en) Method and device for generating information
CN115357282A (en) Application implementation method and device, electronic equipment and storage medium
CN112965713B (en) Development method, device, equipment and storage medium of visual editor
CN115167822A (en) Branch code merging method, device, equipment and storage medium
CN114428615A (en) CSS compiling method, style updating method, device, medium and equipment
CN110647327A (en) Method and device for dynamic control of user interface based on card
CN113760254A (en) Data model generation method and device, electronic equipment and computer readable medium
CN115934093A (en) Small program cross-terminal application method, related device and computer storage medium
CN109522492B (en) A web page content display control method, device, equipment and storage medium
CN112256585A (en) Page display method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20231027

Address after: Rooms 503-16, 5th Floor, Building 2, No.1 and No.3, Qinglong Hutong A, Dongcheng District, Beijing, 100007

Patentee after: Beijing Dongchezu Technology Co.,Ltd.

Address before: 300000 Tianjin Binhai High-tech Zone Binhai Science Park, No. 39, No. 6 High-tech Road, 9-3-401

Patentee before: TIANJIN BYTEDANCE TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right