Configuration method, system, equipment and medium for constructing front-end user interface based on Vite integrated AngularJS
By integrating Vite in AngularJS, transforming frameworks and plug-ins, precompiling and post-style processing, AngularJS construction user interface complexity and performance issues are solved, and a modern front-end development experience and efficient loading performance is achieved.
Patent Information
- Application Number
- CN202411234138.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-09-04
AI Technical Summary
The existing technology is difficult to build a modern front-end user interface on the AngularJS framework that maintains a shutdown, resulting in inefficient development and poor user interface loading performance.
By integrating Vite into AngularJS, planning the project directory structure, transforming the AngularJS framework and plug-in configuration, precompiling and post-style processing, achieving modular and automated construction, and improving user interface loading performance.
It simplifies the complexity of AngularJS to build user interfaces, improves development experience and user interface loading performance, and adapts to modern front-end development paradigms.
Smart Images

Figure CN119088391A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of building user interfaces using Web front-end engineering technology, and specifically relates to a configuration method, system, device and medium for building a front-end user interface based on Vite integrated with AngularJS. Background Art
[0002] From the perspective of the external industry environment, AngularJS, as an old front-end framework born in 2009, has stopped maintenance in 2018. It is out of touch with the times because it does not have modern framework capabilities and development paradigms, and is no longer recommended by the industry for use in new projects. Therefore, its market share is decreasing and its ecosystem is missing. This has caused bottlenecks in the efficiency of experienced developers and made it difficult for new developers to get started.
[0003] From the internal environment, the current APP and some management systems use AngularJS framework technology to build the front-end interface. Although web front-end technology is changing with each passing day, the existing projects have already carried accumulated business logic and a large amount of user traffic. This forces developers to continue iterating on their basis.
[0004] In order to meet the agility and continuity of supporting business development, combined with the current status of the internal and external environment, how to continue to use AngularJS to build the front-end interface while meeting the modern engineering requirements required for front-end development to build the user interface is a problem that technicians in this field need to solve. Summary of the invention
[0005] In view of the deficiencies in the prior art, the present invention provides a configuration method, system, device and medium for building a front-end user interface based on Vite integrated with AngularJS. The invention aims to reduce the complexity of building a user interface using AngularJS, make the development experience more in line with the engineering paradigm of modern front-end development, and improve the loading performance of the user interface at runtime.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] A configuration method for building a front-end user interface based on Vite integrated with AngularJS, comprising the following steps:
[0008] S1: Plan the project directory structure and configure the automatic reading sub-configuration strategy to schedule the reading of configuration files;
[0009] S2: modifying the configuration of the AngularJS framework and the plug-in of the framework to obtain a first input parameter file;
[0010] S3: Configure the pre-compilation process before Vite is built, compile and configure the preset static template, and generate the second input parameter file for Vite to integrate AngularJs;
[0011] S4: extract the first input parameter file obtained in S2 and the second input parameter file obtained in S3, integrate AngularJS according to the configuration rules of Vite, and obtain a first configuration file;
[0012] S5: configure vite to implement the style post-processing compilation process and the local development proxy server to obtain a second configuration file;
[0013] S6: Read the first configuration file and the second configuration file, use commands to execute the script to construct a file set that can be run on the client, and finally present the target user interface.
[0014] To optimize the above technical solutions, the specific measures taken also include:
[0015] Furthermore, in S1, the planning of the project directory structure and the configuration of the automatic reading sub-configuration strategy are specifically:
[0016] Each module in the source code directory follows the hierarchical structure of MVC, which is divided into the structure of model / view / controller, and adopts a decentralized mode to form the distribution of "parent / child configuration files". The parent configuration file is used as the general scheduler to automatically load the target child configuration file according to the directory structure file name; after starting the vite build command process, each parent configuration file automatically matches the configuration file allocated in each child view directory, and then the configuration items in the child configuration file are summarized into the parent configuration file through the compilation process.
[0017] Furthermore, in S2, the configuration of the modified AngularJS framework and the plug-in of the framework is specifically as follows:
[0018] The module definition, dependency injection, and module import configuration methods of the AngularJS framework and its plug-ins are modified at the source code level, and the AMD module definition configuration is converted into the Esbuild module configuration to adapt to the configuration requirements of Vite's module system. For non-core files and asynchronously loaded files, the file content or file path is obtained according to the actual situation by configuring parameters after the file path.
[0019] Furthermore, in S3, the configuration is precompiled before Vite is built, and the static template preset by the compilation configuration is specifically:
[0020] A pre-compilation strategy is used to statically compile preset configuration files and template files. After statically compiling the template, the output file is a file that can participate in the vite build again.
[0021] Furthermore, the configuration items in the sub-configuration file specify a mounting mode of a controller, and the controller is used to schedule a view module.
[0022] Furthermore, in S5, the style post-processing compilation process includes: style post-processing backward-compatible compilation process configuration and HTML template modular compilation process configuration.
[0023] Furthermore, in S6, the use of command execution scripts to construct a file set that can be run on the client includes: automatic reading, merging, cutting, deduplication, zip compression, adding file hashes, and constructing a directory and deployment compression package of a front-end interface that can be run.
[0024] The present invention also proposes a configuration system for building a front-end user interface based on Vite integrated with AngularJS, including:
[0025] Directory planning module, used to plan the project directory structure and configure the automatic reading sub-configuration strategy, used to schedule the reading of configuration files;
[0026] A framework transformation module is used to transform the configuration of the AngularJS framework and the plug-in of the framework to obtain a first input parameter file;
[0027] The pre-compilation configuration module is used to configure the pre-compilation process before Vite is built, compile and configure the preset static template, and generate the second input parameter file for Vite to integrate AngularJs;
[0028] An integration module, used to extract the first input parameter file and the second input parameter file, integrate AngularJS according to the configuration rule of Vite, and obtain a first configuration file;
[0029] The second configuration module is used to configure Vite to implement the style post-processing compilation process and the local development proxy server to obtain a second configuration file;
[0030] The front-end interface module is used to read the first configuration file and the second configuration file, execute the script using commands to construct a file set that can be run on the client, and finally present a target user interface.
[0031] The present invention also proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the configuration method for building a front-end user interface based on Vite integrated with AngularJS as described above is implemented.
[0032] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the configuration method for building a front-end user interface based on Vite integrated with AngularJS as described above.
[0033] The beneficial effects of the present invention are:
[0034] The present invention simplifies the complexity of AngularJS in building user interfaces, making the development experience more in line with the engineering paradigm of modern front-end development, while also improving the loading performance of the user interface at runtime. Through a series of innovative steps, the present invention solves technical problems such as Vite and AngularJS integration, file modularization, precompilation, build output, and style post-processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is a flow chart of the configuration method for building a front-end user interface based on Vite integrated with AngularJS proposed by the present invention.
[0036] Figure 2 The logical architecture of the configuration method for building the front-end user interface based on Vite integrated with AngularJS. DETAILED DESCRIPTION
[0037] The present invention will now be described in further detail with reference to the accompanying drawings.
[0038] Embodiment 1
[0039] The present invention proposes a configuration method for building a front-end user interface based on Vite integrated with AngularJS. The flowchart of the method is as follows: Figure 1 As shown in the figure, the logical structure of this method is as follows Figure 2 As shown, it includes four stages: preparation, precompilation, construction and operation. The method specifically includes the following steps:
[0040] S1: Plan the project directory structure and configure the automatic reading of sub-configuration strategies to schedule the reading of configuration files. In the project directory planning and design, we added the "separation of concerns" and "decentralization" design patterns on the basis of the MVC hierarchical model to plan the configuration files, realizing modular and automated configuration management. Each module in the source code directory follows the hierarchical structure of mvc and is divided into a model / view / controller structure. The implementation of the decentralized model also forms a "parent / child configuration file" distribution. That is: the parent configuration file is used as the general scheduler to automatically load the target sub-configuration file according to the directory structure file name. The following distribution is finally formed:
[0041]
[0042] As shown in the table: After starting the vite build command process, each parent configuration file will automatically match the configuration files assigned to each sub-view directory according to the rules such as ".. / modules / * / *.store.js", ".. / modules / * / *.controller.js" and ".. / modules / * / *.router.js", and then the configuration items in the sub-configuration files will be compiled into the parent configuration file. This allows developers to focus on the sub-view directories involved without paying attention to the codes in the outer directories.
[0043] S2: Modify the configuration of the AngularJS framework and its plug-ins to adapt to the configuration requirements of vite and obtain the first input parameter file; to ensure that vite can correctly handle AngularJS modules and dependencies, firstly, the module definition, dependency injection, and module import configuration methods of the AngularJS framework and other necessary plug-ins must be modified at the source code level, and the AMD module definition configuration must be converted to the Esbuild module configuration to adapt to the configuration requirements of Vite's module system. For non-core files, asynchronously loaded files obtain the file content or file path according to the actual situation by configuring parameters after the file path. Such as "?raw" or "?url".
[0044] S3: Configure the pre-compilation process before Vite is built, compile the preset static template, and generate the second input parameter file for Vite to integrate AngularJs. In the mechanism of the AngularJS framework, there is no separate configuration file that has been extracted. The so-called configuration items are the actual parameters of the function. So the actual situation is that the configuration items are coupled with the code blocks, and they are executed during the startup phase of the framework. In addition, in the configuration of the framework route, the code methods of synchronous and asynchronous are quite different, and there is more code redundancy when configuring multiple routes. Therefore, in this set of configuration methods, a pre-compilation strategy is used to statically compile the preset configuration files and template files. With the feasibility of pre-compilation, a more streamlined configuration file is abstracted. It is also worth mentioning that the output file after static compilation of the template is a file that can participate in the Vite construction again. That is to say, through pre-compilation, the final output is the construction input of Vite integrated with AngularJs, and it is also an executable code snippet of the AngularJS framework.
[0045] S4: Extract the first input parameter file obtained by S2 and the second input parameter file obtained by S3, integrate AngularJS according to the configuration rules of Vite, and obtain the first configuration file. After configuring the Angularjs framework and its related plug-ins after the second step of transformation in vite, developers can also write ES6 syntax that complies with the W3C standard when coding, and can be backward compatible through compilation configuration. This allows developers to not have to worry too much about browser compatibility issues and speed up development efficiency. In subsequent runs, each view module will be scheduled by a separate controller, and the controller's mounting mode is controlled by the configuration items in the configuration file. Implement independent controller scheduling of view modules to improve decoupling between modules.
[0046] S5: Configure Vite to implement the style post-processing compilation process and the local development proxy server to obtain the second configuration file; customize the integrated build configuration provided by Vite to implement the automated build process from source code to production-ready packages. By distinguishing between the local development environment and the production running environment, the local development server is selectively configured. In addition, the compilation process includes: the style post-processing backward-compatible compilation process configuration and the HTML template modular compilation process configuration.
[0047] S6: Read the first configuration file and the second configuration file, use the command to execute the script to build a file set that can be run on the client, and finally present the target user interface. Using the command to execute the script to build a file set that can be run on the client includes: automatic reading of file content, merging, cutting, deduplication, zip compression, adding file hash, and building a directory and deployment compression package of a front-end interface that can be run.
[0048] Embodiment 2
[0049] The present invention proposes a configuration system for building a front-end user interface based on Vite integrated with AngularJS corresponding to the method of the first embodiment, including:
[0050] Directory planning module, used to plan the project directory structure and configure the automatic reading sub-configuration strategy, used to schedule the reading of configuration files;
[0051] A framework transformation module is used to transform the configuration of the AngularJS framework and the plug-in of the framework to obtain a first input parameter file;
[0052] The pre-compilation configuration module is used to configure the pre-compilation process before Vite is built, compile and configure the preset static template, and generate the second input parameter file for Vite to integrate AngularJs;
[0053] An integration module, used to extract the first input parameter file and the second input parameter file, integrate AngularJS according to the configuration rule of Vite, and obtain a first configuration file;
[0054] The second configuration module is used to configure Vite to implement the style post-processing compilation process and the local development proxy server to obtain a second configuration file;
[0055] The front-end interface module is used to read the first configuration file and the second configuration file, execute the script using commands to construct a file set that can be run on the client, and finally present a target user interface.
[0056] The implementation methods of each module and module function in the system are completely consistent with the steps of the method in Example 1, so they will not be repeated here.
[0057] Embodiment 3
[0058] The present invention proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the configuration method for building a front-end user interface based on Vite integrated with AngularJS as described in Embodiment 1 is implemented.
[0059] Embodiment 4
[0060] The present invention provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the configuration method for building a front-end user interface based on Vite integrated with AngularJS as described in the first embodiment.
[0061] In the embodiments disclosed in the present application, the computer storage medium can be a tangible medium that can contain or store a program for use by or in combination with an instruction execution system, device or equipment. The computer storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of computer storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0062] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0063] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.
Claims
1. A configuration method for building a front-end user interface based on Vite integrated with AngularJS, characterized in that: The following steps are involved: S1: Plan the project directory structure and configure the automatic reading sub-configuration strategy to schedule the reading of configuration files; S2: modify the configuration of the AngularJS framework and the plug-in of the framework to obtain a first input parameter file; S3: Configure the pre-compilation process before Vite is built, compile and configure the preset static template, and generate the second input parameter file for Vite to integrate AngularJs; S4: extract the first input parameter file obtained in S2 and the second input parameter file obtained in S3, integrate AngularJS according to the configuration rules of Vite, and obtain a first configuration file; S5: configure vite to implement the style post-processing compilation process and the local development proxy server to obtain the second configuration file; S6: Read the first configuration file and the second configuration file, execute the script using commands to construct a file set that can be run on the client, and finally present the target user interface.
2. The configuration method for building a front-end user interface based on Vite integrated with AngularJS as claimed in claim 1, characterized in that: In S1, the planning of the project directory structure and the configuration of the automatic reading sub-configuration strategy are specifically as follows: Each module in the source directory follows the hierarchical structure of MVC, which is divided into the structure of model / view / controller, and adopts a decentralized mode to form the distribution of "parent / child configuration files". The parent configuration file is used as the general scheduler to automatically load the target child configuration file according to the directory structure file name; after starting the vite build command process, each parent configuration file automatically matches the configuration file allocated in each child view directory, and then the configuration items in the child configuration file are summarized into the parent configuration file through the compilation process.
3. The configuration method for building a front-end user interface based on Vite integrated with AngularJS as claimed in claim 1, characterized in that: In S2, the configuration of the modified AngularJS framework and the plug-in of the framework is specifically as follows: The module definition, dependency injection, and module import configuration methods of the AngularJS framework and its plug-ins are modified at the source code level, and the AMD module definition configuration is converted into the Esbuild module configuration to adapt to the configuration requirements of Vite's module system. For non-core files and asynchronously loaded files, the file content or file path is obtained according to the actual situation by configuring parameters after the file path.
4. The configuration method for building a front-end user interface based on Vite integrated with AngularJS as claimed in claim 1, characterized in that: In S3, the configuration is precompiled before Vite is built, and the static template preset by the compilation configuration is specifically: A pre-compilation strategy is used to statically compile preset configuration files and template files. After statically compiling the template, the output file is a file that can participate in the vite build again.
5. The configuration method for building a front-end user interface based on Vite integrated with AngularJS as claimed in claim 2, characterized in that: The configuration items in the sub-configuration file specify the mounting mode of the controller, which is used to schedule the view module.
6. The configuration method for building a front-end user interface based on Vite integrated with AngularJS as claimed in claim 1, characterized in that: In S5, the style post-processing compilation process includes: style post-processing backward compatibility compilation process configuration and HTML template modular compilation process configuration.
7. The configuration method for building a front-end user interface based on Vite integrated with AngularJS as claimed in claim 1, characterized in that: In S6, the command execution script is used to construct a file set that can be run on the client, including: automatic reading, merging, cutting, deduplication, zip compression, adding file hashes, and constructing a directory and deployment compressed package of a front-end interface that can be run.
8. A configuration system for building a front-end user interface based on Vite integrated with AngularJS, characterized in that: include: Directory planning module, used to plan the project directory structure and configure the automatic reading sub-configuration strategy, used to schedule the reading of configuration files; A framework transformation module is used to transform the configuration of the AngularJS framework and the plug-in of the framework to obtain a first input parameter file; The pre-compilation configuration module is used to configure the pre-compilation process before Vite is built, compile and configure the preset static template, and generate the second input parameter file for Vite to integrate AngularJs; An integration module, used to extract the first input parameter file and the second input parameter file, integrate AngularJS according to the configuration rule of Vite, and obtain a first configuration file; The second configuration module is used to configure Vite to implement the style post-processing compilation process and the local development proxy server to obtain the second configuration file; The front-end interface module is used to read the first configuration file and the second configuration file, execute the script using commands to construct a file set that can be run on the client, and finally present a target user interface.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the configuration method for building a front-end user interface based on Vite integrated with AngularJS as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: A computer program is stored, and the computer program enables the computer to execute the configuration method for building a front-end user interface based on Vite integrated with AngularJS as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Design and construction method of universal front-end UI component library
CN113553035A
Method and system for constructing front-end UI component library
CN115509519A
Universal frame based on Vite
CN116088801A
Project reconstruction method, device and equipment based on AngularJS framework and medium
CN117555587A
Program generating apparatus, and program generating method
JP2020087033A
