Front-end development method, device, electronic device and storage medium

By building a basic front-end project in the front-end project and using style development tools such as Tailwindcss to directly develop styles on the web page, the problem of low style development efficiency in front-end development is solved, and code simplification and compatibility improvement are achieved.

CN118069127BActive Publication Date: 2024-10-29NETTRIX INFORMATION IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211466442.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-22
Publication Date
2024-10-29
Estimated Expiration
2042-11-22

AI Technical Summary

Technical Problem

In existing front-end development technology, when using CSS tools to develop styles for front-end projects, it is necessary to repeatedly switch back and forth between the web page and the CSS development page, resulting in low development efficiency, complex code structure and confusing logic, making it difficult to locate the modified content and consuming a lot of time. cost.

Method used

By building a basic front-end project and adding style development tools, such as Tailwindcss, to develop styles directly in the web page, avoiding switching back and forth between style development tools and web pages, and introducing prefix auxiliary plug-in tools and component management system tools to achieve Browser compatibility and rapid component design.

Benefits of technology

It improves the development efficiency of front-end projects, simplifies the style development process, reduces the amount of code, enhances the compatibility and applicability of the project, and reduces the time cost of developers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118069127B_ABST
    Figure CN118069127B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a front-end development method, device, electronic device and storage medium, the method comprising: building and starting a basic front-end project through a target front-end project development tool; adding a style development tool to the basic front-end project; and developing a style in a web page of the basic front-end project through the style development tool. The technical solution of the embodiment of the present invention can improve the development efficiency of the front-end project.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of front-end development technology, and in particular to a front-end development method, device, electronic device and storage medium. Background Art

[0002] With the development of science and technology, front-end framework technologies emerge in an endless stream, and each front-end development technology also has different technical characteristics.

[0003] At present, there are many front-end frameworks to choose from, but when adding styles to websites, most still use CSS (Cascading Style Sheets) style development tools. When CSS inserts styles into HTML (Hyper Text Markup Language) pages, each class needs to be named, and the context needs to be repeatedly switched between the CSS development interface and the HTML page.

[0004] In the process of realizing the present invention, the inventor found that the prior art has the following problems: At present, when developing front-end projects, developers usually adopt the front-end framework technology + front-end technology + CSS method to develop, or adopt the HTML + front-end technology + CSS method to develop. In the above development method, developers use CSS tools to add styles to front-end projects. This front-end project development method has various problems such as slow development process, complex code structure of front-end projects, and confusing code logic. Especially when modifying the style of the website during the development process, developers are required to configure corresponding names for each content that needs to be styled, and developers need to spend a lot of development work to switch back and forth between css and jsx (conventional JavaScript) files. In this way, it is difficult to locate the modified content and the problem when modifying the style of the front-end project, which consumes a lot of time and reduces the development efficiency of the front-end project. Summary of the invention

[0005] The embodiments of the present invention provide a front-end development method, device, electronic device and storage medium, which can improve the development efficiency of front-end projects.

[0006] According to one aspect of the present invention, a front-end development method is provided, comprising:

[0007] Build and start basic front-end projects through target front-end project development tools;

[0008] Add style development tools to the basic front-end project;

[0009] The style is developed in the web page of the basic front-end project by using the style development tool.

[0010] Furthermore, the target front-end project development tools are used to build and start the basic front-end project, including:

[0011] Build the scaffolding of the basic front-end project through the front-end project creation command;

[0012] Download and install the project template of the basic front-end project in the scaffold through a project template creation command;

[0013] Enter and start the basic front-end project through the project entry command and project start command.

[0014] The advantage of this setting is that by downloading and starting the scaffolding of the front-end development project, technicians can directly develop the front-end project in the scaffolding environment without configuring the development environment of the basic front-end project, thereby saving development steps and improving the development efficiency of the front-end project.

[0015] Furthermore, a style development tool is added to the basic front-end project, including:

[0016] Install the style development tool in the basic front-end project through a style development tool installation command;

[0017] Insert the style development tool into the project configuration file of the basic front-end project through a style development tool insertion command;

[0018] A tool configuration file of the style development tool is generated by a configuration file generation command.

[0019] The advantage of such a setting is that by inserting a style development tool into the front-end development project, the technical personnel can directly modify the style in the web page of the front-end development project.

[0020] Further, inserting a prefix auxiliary plug-in tool into a project configuration file of the basic front-end project through a prefix auxiliary plug-in tool insertion command;

[0021] The prefix auxiliary plug-in tool is used to automatically complete the associated prefixes of the browser.

[0022] The advantage of this setting is that by inserting the prefix auxiliary plug-in tool in the front-end development project, the browser compatibility requirements can be met, thereby improving the compatibility and applicability of the front-end project.

[0023] Furthermore, after the basic front-end project is built and started by the target front-end project development tool, it also includes:

[0024] Component management system tools to identify target components;

[0025] Obtain the target component from the component management system tool through a target component installation command, and install the target component in the basic front-end project;

[0026] Modify the entry file of the basic front-end project to add the style folder of the basic front-end project to the entry file;

[0027] Add the component style folder of the target component to the style folder of the basic front-end project.

[0028] The advantage of this setting is that by introducing the target component into the basic front-end project, the component can be quickly designed, while also reducing the amount of code for developers, further improving the development efficiency of the front-end project.

[0029] Furthermore, after adding the component style folder of the target component to the style folder of the basic front-end project, the method further includes:

[0030] Install the custom configuration file in the basic front-end project through the custom configuration file installation command;

[0031] Modify the property script field of the project configuration file in the basic front-end project;

[0032] Create a configuration subfile of the custom configuration file in the root directory of the project configuration file;

[0033] The on-demand loading configuration information of the target component is added to the configuration sub-file to load the specified components included in the target component in the basic front-end project.

[0034] The advantage of this setting is that by simplifying the target components and realizing on-demand loading of the target components, the loading and development speed of the target components can be increased, thereby improving the development efficiency of the front-end project.

[0035] Furthermore, the target front-end project development tool includes React, the style development tool includes Tailwindcss, and the target component includes antd component.

[0036] According to another aspect of the present invention, there is provided a front-end development device, comprising:

[0037] The basic front-end project startup module is used to build and start the basic front-end project through the target front-end project development tool;

[0038] A style development tool adding module, used to add a style development tool to the basic front-end project;

[0039] The style development module is used to develop styles in the web pages of the basic front-end project through the style development tool.

[0040] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0041] at least one processor; and

[0042] a memory communicatively connected to the at least one processor; wherein,

[0043] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the front-end development method described in any embodiment of the present invention.

[0044] According to another aspect of the present invention, a computer storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the front-end development method described in any embodiment of the present invention when executed.

[0045] The technical solution of the embodiment of the present invention first builds and starts a basic front-end project through a target front-end project development tool, and then adds a style development tool to the basic front-end project, so as to develop styles in the web pages of the basic front-end project through the style development tool. There is no need to switch back and forth between the development page of the style development tool and the web page to develop the style of the front-end project. This solves the problem of low front-end project development efficiency caused by the need to repeatedly switch back and forth between the web page and the CSS development page when developing the style of the front-end project using the existing CSS tool, and can improve the development efficiency of the front-end project.

[0046] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0048] Figure 1 is a flow chart of a front-end development method provided by an embodiment of the present invention;

[0049] Figure 2 is a flow chart of another front-end development method provided by an embodiment of the present invention;

[0050] Figure 3 This is a schematic diagram of an interface of a template project with a directory structure provided by an embodiment of the present invention;

[0051] Figure 4 It is a schematic diagram of the working principle of React in an embodiment of the present invention;

[0052] Figure 5 It is a structural schematic diagram of a front-end development device provided by an embodiment of the present invention;

[0053] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0055] It should be noted that the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatus.

[0056] Figure 1 It is a flow chart of a front-end development method provided by an embodiment of the present invention. This embodiment is applicable to the situation where rapid front-end development is performed during the process of modifying the website style. The method can be executed by a front-end development device, which can be implemented by software and / or hardware. The front-end development device can be configured in any electronic device with network communication function.

[0057] Correspondingly, such as Figure 1 As shown, the method includes the following operations:

[0058] S110. Build and start the basic front-end project through the target front-end project development tool.

[0059] The target front-end project development tool is a development tool used in the process of creating front-end pages such as WEB (World Wide Web) pages or APP (Application).

[0060] Exemplarily, the target front-end project development tool can be the Vue framework, which is a progressive framework for building user interfaces. Unlike other heavyweight frameworks, Vue adopts a bottom-up incremental development design, and the core library only focuses on the view layer, so it is easier to learn and more conducive to integration with other libraries or other projects. At the same time, when used with related tools and support libraries, it can also drive complex single-page applications. The target front-end project development tool can also be the React framework, which is a JavaScript library for building user interfaces. The React framework uses a declarative paradigm that can easily describe applications; by simulating the DOM (Document Object Model), it minimizes interaction with the DOM, so its performance is higher. At the same time, React can also be integrated with other libraries or other projects.

[0061] Among them, the basic front-end project is a front-end project with basic front-end functions built by the target front-end project development tool. Further development can be done based on the basic front-end project to enrich the front-end functions of the basic front-end project. It can be understood that the front-end project refers to the page production or static page production of the website, which is the part that directly interacts with the user, including all the visual content encountered when browsing the web page - from fonts to colors, as well as drop-down menus and sidebars. These visual contents are parsed, processed and presented by the browser.

[0062] Optionally, the basic front-end project can be a static web page project running on a PC. A static web page is a standard HTML file that may include, but is not limited to, text, images, sounds, client scripts, and JAVA (computer programming language) applets.

[0063] Optionally, the basic front-end project can also be a dynamic web page project running on a PC. Dynamic web pages are different from static web pages in that the content displayed on the browser can change with time, environment, or the result of database operations.

[0064] In an embodiment of the present invention, before developing a front-end project, a basic front-end project can be first built using a target front-end project development tool. After the basic front-end project is built, the basic front-end project can be started to continue the subsequent front-end project development process.

[0065] S120. Add a style development tool to the basic front-end project.

[0066] Among them, the style development tool is a computer language used to express file styles such as HTML or XML (Xtensible Markup Language). The style development tool can be a tool for style development of basic front-end projects. In an embodiment of the present invention, the style development tool can be a tool that can directly develop styles in the web pages of the basic front-end projects. That is, the style development tool introduced in the embodiment of the present invention can directly insert the style to be developed in the web page without repeatedly switching back and forth between the web page and the development page of the style development tool, thereby improving the efficiency of style development and further improving the development efficiency of the front-end project.

[0067] In the embodiment of the present invention, after the basic front-end project is officially started, a style development tool can be added to the started basic front-end project to provide a style development function for the basic front-end project through the added style development tool.

[0068] It is understandable that the style development tool can realize static modification of web pages, and can also dynamically format various elements of web pages with various scripting languages. At the same time, the style development tool can also support all font sizes and styles, and has the ability to edit web page objects and model styles. Its usage features include rich style definitions, easy use and modification, multi-page application, cascading, and page compression.

[0069] Optionally, the style development tool can be Tailwindcss. Tailwindcss is a customizable, class-first, low-level style sheet created by Adam Wathan. It can integrate feature-rich classes such as flex (creating RIA), text-center (centering child elements) and rotate-90 (rotating 90 degrees), etc., so that you can quickly create a website without leaving HTML during the development process.

[0070] S130: Developing a style in the web page of the basic front-end project by using the style development tool.

[0071] Among them, the style can be a beautification operation on a web page, which can improve the beauty of the web page. The development style can be the development of various styles such as font style, list style, table style and web page layout. The web page can be a page developed by the front end such as HTML.

[0072] In an embodiment of the present invention, optionally, react can be used as the target front-end project development tool, and Tailwindxss can be used as the style development tool to combine react and Tailwindxss to achieve rapid development of front-end projects. In the above development method, Tailwindxss can directly develop styles in the web pages of the basic front-end project built by react, without repeatedly switching the development style back and forth between the development interface of the style development tool and the web pages of the front-end project, thereby improving the efficiency of style development in the front-end project, and then improving the development efficiency of the front-end project.

[0073] Specifically, when developing styles in a web page of a basic front-end project using a style development tool, you can choose to modify the font color, font size, font type, font style, font type, and alignment in the web page according to development requirements. In addition, you can also choose to modify the layout of the web page, including setting margins, inner margins, and border lines. The embodiment of the present invention does not limit the specific content of the development style.

[0074] The technical solution of the embodiment of the present invention first builds and starts a basic front-end project through a target front-end project development tool, and then adds a style development tool to the basic front-end project, so as to develop styles in the web pages of the basic front-end project through the style development tool. There is no need to switch back and forth between the development page of the style development tool and the web page to develop the style of the front-end project. This solves the problem of low front-end project development efficiency caused by the need to repeatedly switch back and forth between the web page and the CSS development page when developing the style of the front-end project using the existing CSS tool, and can improve the development efficiency of the front-end project.

[0075] Figure 2 is a flow chart of another front-end development method provided by an embodiment of the present invention. This embodiment is specific based on the above embodiment. In this embodiment, a specific optional implementation method of building and starting a basic front-end project, adding a style development tool to the basic front-end project, and introducing a target component to the basic front-end project is provided. Figure 2 As shown, the method of this embodiment may include:

[0076] S210: Build a scaffolding of the basic front-end project through a front-end project creation command.

[0077] The front-end project creation command may be a command for creating a basic front-end project. The scaffolding may be a template project for assisting technicians to quickly create a type library, which includes all the configurations required for the basic front-end project and specifies the required dependency packages.

[0078] In an embodiment of the present invention, by inputting a front-end project creation command to build a scaffold of a basic front-end project, a development environment of the basic front-end project can be created. Developers can develop the basic front-end project in the scaffold without spending time configuring the development environment of the basic front-end project, thereby further improving the development efficiency of the front-end project.

[0079] In a specific example, assuming that the target front-end project development tool is the react tool, a basic front-end project can be built and started through the react tool. Among them, the react tool includes the create-react-app component. The create-react-app component is an application development component officially provided by react for building react projects. The create-react-app component contains all the configurations and dependency packages required for react projects. Therefore, you can use the react tool's front-end project creation command: "npm install-g create-react-app" to build a scaffold based on react, webpack (module bundler) and es6 (next generation Javascript standard).

[0080] S220. Download and install the project template of the basic front-end project in the scaffold through a project template creation command.

[0081] The project module creation command may be a creation command for downloading and creating a project template in a scaffold. The project template may be a basic project with its own directory structure.

[0082] Correspondingly, after the scaffolding is completed, the development environment of the basic front-end project is successfully configured. At this point, you can further enter the project template creation command to download and install the project template of the basic front-end project in the scaffolding.

[0083] Taking the above example as an example, you can execute the project module creation command "create-react-app react-admin" (where react-admin refers to the project name of the specific basic front-end project, which can be customized) in the built scaffold to download the project template for creating the basic front-end project react-admin and install the project template in the scaffold. All subsequent development processes for the basic front-end project can be completed based on the project template of the basic front-end project installed in the scaffold.

[0084] S230: Enter and start the basic front-end project through a project entry command and a project start command.

[0085] The project entry command may be a command for entering a template project, and the project start command may be a command for starting a template project.

[0086] In an embodiment of the present invention, you can enter the template project of the basic front-end project by inputting a project entry command, and then start the basic front-end project by inputting a project start command, and then continue the subsequent front-end development process in the started template project.

[0087] Taking the above example as an example, enter the project entry command in the scaffolding environment: "cd react-admin" to enter the template project named react-admin. Then enter the project start command: "npmstart" to start the react-admin template project, and get the following Figure 3 The template project of the front-end basic project with its own directory structure is shown.

[0088] The above technical solution, by downloading and starting the scaffolding of the front-end development project, allows technicians to directly develop the front-end project in the scaffolding environment without having to configure the development environment of the basic front-end project, thereby saving development steps and improving the development efficiency of the front-end project.

[0089] S240. Determine a component management system tool for the target component.

[0090] The target component may be a component type that needs to be added to the target front-end project development tool for developing components. The component management system tool may be a system tool that can provide the target component.

[0091] In the embodiment of the present invention, in order to enrich the development function of the front-end project, the target component can be introduced into the target front-end project development tool. Before introducing the target component, the component management system tool of the target component needs to be determined first.

[0092] Optionally, the target component can be an Onsen UI (Onsen User Interface, mobile application design) component library that can provide Onsen UI component types. Among them, Onsen UI is a rich UI (User Interface, user interface) component designed specifically for mobile applications, with timely implementation functions that follow native iOS (Apple system) and Android (Android system) design standards. Enrich the mobile experience of application users through natively designed UI elements.

[0093] Optionally, the target component can also be an AntDesign (Antd) component. Antd components provide a series of more atomic components for users to implement customized components. Antd components also have the characteristics of visual simplicity and friendly interaction, and are widely used in React technology.

[0094] S250. Obtain the target component from the component management system tool through a target component installation command, and install the target component in the basic front-end project.

[0095] The target component installation command may be a command for installing the target component in the basic front-end project.

[0096] In the embodiment of the present invention, after determining the type of target component to be introduced, the target component installation command can be input in the basic front-end project to obtain the target component to be used from the target component installation command building management system tool and install it in the basic front-end project. After the installation is completed, the basic front-end project can use all components in the target component.

[0097] Taking the above example as an example, when the antd component is used as the target component, yarn or npm can be used as the component management system tool of the target component. Therefore, you can enter the target component installation command in the basic front-end project: "yarn add antd", remotely obtain the required antd component from the component management system tool yarn, and install and introduce the antd component in the started project react-admin. Alternatively, you can also enter the target component installation command in the basic front-end project: "npm install antd", remotely obtain the required antd component from the component management system tool npm, and install and introduce the target component antd in the started project react-admin, so as to use all the components in antd in the project react-admin.

[0098] S260. Modify the entry file of the basic front-end project to add the style folder of the basic front-end project to the entry file.

[0099] S270. Add the component style folder of the target component to the style folder of the basic front-end project.

[0100] The entry file can be an internal file of the project used to quickly enter the front-end project for specific development configuration. The style folder can be used to store all style files of the front-end project. The component style folder can be used to store all style files of the component.

[0101] Correspondingly, after the target component is installed in the basic front-end project, the basic front-end project cannot officially use the target certificate. At this time, it is necessary to open the entry file of the basic front-end project and add the style folder of the basic front-end project to the entry file. It is understandable that all configuration information for the style of the components in the basic front-end project is stored in the style folder of the basic front-end project. Therefore, it is necessary to add the style folder of the basic front-end project to retain the file style of the basic front-end project. Furthermore, the component style folder of the target component can be added to the style folder of the basic front-end project. It is understandable that the component style folder can retain all the styles of the target component in the basic front-end project.

[0102] Taking the above example as an example, let's assume that the entry file of the basic front-end project is: src / App.js. After the antd component is installed, open the entry file src / App.js of the basic front-end project react-admin, add the style folder of the basic front-end project: src / App.css in the entry file, and then you can keep all the style data of the basic front-end project in the style folder of the basic front-end project. Furthermore, add the component style folder of the antd component: antd / dist / antd.css in the style folder src / App.css of the basic front-end project. After adding, refresh the development interface of the basic front-end project, and you can use the antd component in the development interface.

[0103] The above technical solution can quickly design the components by introducing the target components into the basic front-end project, and can also reduce the amount of code for developers, further improving the development efficiency of the front-end project.

[0104] S280. Install the custom configuration file in the basic front-end project through a custom configuration file installation command.

[0105] S290. Modify the property script field of the project configuration file in the basic front-end project.

[0106] S2100. Create a configuration subfile of the custom configuration file in the root directory of the project configuration file.

[0107] S2110. Add the on-demand loading configuration information of the target component in the configuration sub-file to load the specified components included in the target component in the basic front-end project.

[0108] Among them, the custom configuration file installation command can be a command for installing a custom configuration file in the basic front-end project. The custom configuration file can be a custom configuration file introduced for the basic front-end project. The project configuration file can be a configuration file included in the basic front-end project itself. The property script field can be a field type in the project configuration file, and each property thereof can correspond to a script. The configuration subfile can be a configuration file including all configuration data of the custom configuration file. The on-demand loading configuration information can be configuration information for on-demand loading of the target component.

[0109] It is understandable that the target components usually introduced in the basic front-end project include a large number of component types, but not all components are required by developers. Therefore, the target components can be further simplified to achieve on-demand loading of target components.

[0110] Specifically, you can enter a custom configuration file installation command in the basic front-end project to install the custom configuration file in the basic front-end project. Furthermore, modify the property script field of the project configuration file in the basic front-end project to enable on-demand loading of the target component. Furthermore, you also need to create a configuration sub-file of the custom configuration file in the root directory of the project configuration file to add on-demand loading configuration information of the target component in the created configuration sub-file, so as to load the specified components included in the target component in the basic front-end project and realize on-demand loading of the target component.

[0111] Taking the above example as an example, after the component style folder of the antd component: antd / dist / antd.css is added, use the npm command: "npm install@craco / craco-force" to install the custom configuration file craco in react-admin. Further, modify the content of the property script field scripts of the project configuration file package.json in react-admin. Specifically, you can add the relevant content of starting craco, generating craco, and testing craco in scripts to make craco effective. At the same time, you also need to create a craco configuration subfile: craco.config.js file in the root directory of package.json, and insert the on-demand loading configuration information of the antd component in the craco.config.js file, so that the specified component can be loaded in react-admin. Among them, inserting the on-demand loading configuration information of the antd component in the craco.config.js file can be specifically introducing the craco-less installation package or plug-in in craco.config.js. craco-less is a plug-in for processing files named with the suffix less. Because developers will use folders with the suffix less files when developing front-end projects, it is necessary to introduce the craco-less plug-in to process less files.

[0112] The above technical solution can improve the loading and development speed of the target components by simplifying the target components and realizing on-demand loading of the target components, thereby improving the development efficiency of the front-end project.

[0113] S2120. Install the style development tool in the basic front-end project through a style development tool installation command.

[0114] S2130, inserting the style development tool into the project configuration file of the basic front-end project through a style development tool insertion command;

[0115] The style development tool installation command may be an installation command for installing the style development tool in the basic front-end project. The style development tool insertion command may be a command for inserting the style development tool in the project configuration file.

[0116] In an embodiment of the present invention, a style development tool installation command may be input in the basic front-end project to install the style development tool in the basic front-end project. After the style development tool is installed, a style development tool insertion command needs to be further input to add the style development tool to the project configuration file of the basic front-end project so that the style development tool takes effect.

[0117] In an optional embodiment of the present invention, the front-end development method may further include: inserting a prefix auxiliary plug-in tool into a project configuration file of the basic front-end project through a prefix auxiliary plug-in tool insertion command.

[0118] The prefix auxiliary plug-in tool insertion command may be a command for inserting a prefix auxiliary plug-in tool into a project configuration file of a basic front-end project. The prefix auxiliary plug-in tool may be a plug-in tool for automatically completing the associated prefix of the browser. The prefix is ​​also the prefix of the browser style name.

[0119] In an embodiment of the present invention, in order to improve the compatibility of the front-end project with various types of browsers, when the style development tool is inserted and enabled in the basic front-end project, a command can be inserted through the prefix auxiliary plug-in tool to add the prefix auxiliary plug-in tool to the project configuration file of the basic front-end project. After adding the prefix auxiliary plug-in tool, the developed front-end project can be compatible with various types of browsers.

[0120] Taking the above example as an example, when Tailwindcss is used as a style development tool, you can enter the style development tool installation command and the prefix auxiliary plug-in tool insertion command in the basic front-end project react-admin: "npminstall-D tailwindcss@npm:@tailwindcss / postcss7postcss@^8autoprefixer@^9" to install the style development tool tailwindcss and the prefix auxiliary plug-in tool autoprefixer in the basic front-end project react-admin through this command. Further, after the installation of tailwindcss and autoprefixer is complete, tailwindcss and autoprefixer will be inserted as postcss plug-ins into craco.config.js of react-admin's package.json to make tailwindcss and autoprefixer take effect. Among them, postcss is a tool that converts js plug-ins into css. Postcss is used to support variables and mixins. Compatibility styles can be generated by appending browser prefixes, and new style features can be processed into universal styles through polyfill. CSS modules and style rule verification can be used.

[0121] The above technical solution can meet the browser compatibility requirements by inserting a prefix auxiliary plug-in tool into the front-end development project, thereby improving the compatibility and applicability of the front-end project.

[0122] S2140: Generate a tool configuration file for the style development tool through a configuration file generation command.

[0123] The configuration file generation command may be a command used to generate a tool configuration file. The tool configuration file may be a configuration file required for the style development tool to be configured.

[0124] In an embodiment of the present invention, after the style development tool is introduced into the basic front-end project, it is necessary to further input a configuration file generation command into the basic front-end project to generate a tool configuration file of the style development tool, which may include all configuration information required by the style development tool.

[0125] Taking the above example as an example, you can enter the configuration file generation command in react-admin: "npxtailwindcss-cli@latest init" to get the tool configuration file tailwind.config.js of the style development tool Tailwindcss. Among them, tailwind.config.js includes all the basic setting information of Tailwind.

[0126] In the above technical solution, by inserting a style development tool into the front-end development project, the technical personnel can directly modify the style in the web page of the front-end development project.

[0127] S2150. Develop a style in the web page of the basic front-end project using the style development tool.

[0128] In order to more clearly describe the technical solution provided by the embodiment of the present invention, the embodiment of the present invention adopts React as the target front-end project development tool and Tailwindcss as the style development tool, and specifically describes the front-end development method provided by the embodiment of the present invention.

[0129] React works by using a new Diffing algorithm, in which all DOM construction is done through virtual DOM. Whenever data changes, React rebuilds the entire DOM tree, and then compares the current DOM tree with the previous DOM tree to get the difference in DOM structure, and then only updates the actual browser DOM for the parts that need to be changed. Figure 4 Schematic diagram of the working principle of a React provided by an embodiment of the present invention. In a specific example, Figure 4As shown, first, React converts the JSX file named with the suffix js into a JSX file and then runs the JSX file. When React runs the JSX file in the browser, it needs to use the Diff algorithm in the browser's JavaScript interpreter and the browser's native engine to actually update the browser DOM for the parts that need to be changed.

[0130] In the embodiment of the present invention, based on the React technology, two tools, Antd and Tailwindcss, are combined to realize rapid development of front-end projects.

[0131] First, use the npm install –g create-react-app command to build a scaffold based on react, webpack, and es6 to provide all the configurations and required dependency packages required by react.

[0132] After the scaffolding is completed, use the create-react-app react-admin command to download the template project. After the template project is downloaded, use the cd react-admin command to enter the react-admin front-end project, and then start react-admin with the npm start command. When you see a folder with a directory structure generated, a simple project is started.

[0133] After the react-admin project is started, use the yarn add antd command to get the antd component from yarm, and install and import antd in react-admin, or use the npm install antd command to get the antd component from npm, and install and import antd in react-admin.

[0134] Furthermore, modify the entry file of react-admin and add the style folder src / App.css to the entry file src / App.js of react-admin. At the same time, you need to add the antd component style folder: src / dist / antd / css file to src / App.css to introduce the antd component style. At this point, you can use the antd component to develop components in react-admin.

[0135] In order to further improve the development efficiency of front-end projects, antd can be loaded on demand. Specifically, use the npm install@craco and craco-force commands to install craco. At the same time, you need to modify the content of scripts in the project configuration file package.json of react-admin. Specifically, you can add the relevant content of starting craco, generating craco, and testing craco in scripts to make craco effective. After completing the modification of the project configuration file, continue to create the craco configuration subfile craco.config.js in the root directory of the project configuration file package.json, and insert the corresponding on-demand loading information in craco.config.js to realize the on-demand loading of antd.

[0136] Furthermore, use the command npm install-D tailwindcss@npm:@tailwindcss / postcss7postcss@^8autoprefixer@^9 to install the tailwindcss and autoprefixer tools in react-admin. After the installation is complete, insert tailwindcss and autoprefixer as postcss plug-ins into package.json. The tailwindcss tool can directly modify the development style in the web page, and the autoprefixer tool can automatically complete the browser prefix to improve the compatibility of react-admin.

[0137] Finally, use the command npx tailwindcss-cli@latest init to generate the configuration file tailwindcss / config.js of tailwindcss. In this way, you can use the style development tool tailwindcss in react-admin to directly develop the style of the web page, that is, use tailwindcss technology instead of css to develop the web page style.

[0138] By using the above combination solution as a front-end development method, front-end developers can quickly build a react project without having to name each content that needs to be styled, nor do they need to switch back and forth between css and jsx files. At the same time, when modifying the style, they can easily locate the modified content, which greatly improves the development efficiency of front-end personnel and allows developers to focus on performance improvement and code optimization.

[0139] Figure 5 is a schematic diagram of a front-end development device provided by an embodiment of the present invention, such as Figure 5 As shown, the device includes: a basic front-end project starting module 310, a style development tool adding module 320 and a style development module 330, wherein:

[0140] A basic front-end project startup module 310 is used to build and start a basic front-end project through a target front-end project development tool;

[0141] A style development tool adding module 320 is used to add a style development tool to the basic front-end project;

[0142] The style development module 330 is used to develop styles in the web pages of the basic front-end project by using the style development tool.

[0143] The technical solution of the embodiment of the present invention first builds and starts a basic front-end project through a target front-end project development tool, and then adds a style development tool to the basic front-end project, so as to develop styles in the web pages of the basic front-end project through the style development tool. There is no need to switch back and forth between the development page of the style development tool and the web page to develop the style of the front-end project. This solves the problem of low front-end project development efficiency caused by the need to repeatedly switch back and forth between the web page and the CSS development page when developing the style of the front-end project using the existing CSS tool, and can improve the development efficiency of the front-end project.

[0144] Optionally, the basic front-end project startup module 310 is specifically used to: build a scaffolding of the basic front-end project through a front-end project creation command; download and install the project template of the basic front-end project in the scaffolding through a project template creation command; enter and start the basic front-end project through a project entry command and a project startup command.

[0145] Optionally, the style development tool adding module 320 is specifically used to: install the style development tool in the basic front-end project through a style development tool installation command; insert the style development tool into the project configuration file of the basic front-end project through a style development tool insertion command; and generate a tool configuration file for the style development tool through a configuration file generation command.

[0146] Optionally, the front-end development device also includes a prefix auxiliary plug-in tool module, which is used to: insert a prefix auxiliary plug-in tool into the project configuration file of the basic front-end project through a prefix auxiliary plug-in tool insertion command; wherein the prefix auxiliary plug-in tool is used to automatically complete the associated prefix of the browser.

[0147] Optionally, the front-end development device also includes a target component determination module, which is used to: determine a component management system tool of the target component; obtain the target component from the component management system tool through a target component installation command, and install the target component in the basic front-end project; modify the entry file of the basic front-end project to add a style folder of the basic front-end project to the entry file; and add a component style folder of the target component to the style folder of the basic front-end project.

[0148] Optionally, the target component determination module is specifically used to: install a custom configuration file in the basic front-end project through a custom configuration file installation command; modify the property script field of the project configuration file in the basic front-end project; create a configuration sub-file of the custom configuration file under the root directory of the project configuration file; add the on-demand loading configuration information of the target component in the configuration sub-file to load the specified components included in the target component in the basic front-end project.

[0149] Optionally, the target front-end project development tool includes React, the style development tool includes Tailwindcss, and the target component includes an antd component.

[0150] The front-end development device can execute the front-end development method provided by any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the front-end development method provided by any embodiment of the present invention.

[0151] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0152] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0153] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0154] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a multi-core processor stability test method.

[0155] In some embodiments, the front-end development method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the multi-core processor stability test method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the front-end development method in any other appropriate manner (e.g., by means of firmware).

[0156] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0157] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0158] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0159] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0160] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0161] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

Claims

1. A front-end development method, characterized in that: include: Build and start basic front-end projects through target front-end project development tools; Add style development tools to the basic front-end project; Developing styles in the web pages of the basic front-end project by using the style development tool; After building and starting the basic front-end project through the target front-end project development tool, it also includes: Component management system tools to identify target components; Obtain the target component from the component management system tool through a target component installation command, and install the target component in the basic front-end project; Modify the entry file of the basic front-end project to add the style folder of the basic front-end project to the entry file; Add the component style folder of the target component to the style folder of the basic front-end project; After adding the component style folder of the target component to the style folder of the basic front-end project, it also includes: Install the custom configuration file in the basic front-end project through the custom configuration file installation command; Modify the property script field of the project configuration file in the basic front-end project; Create a configuration subfile of the custom configuration file in the root directory of the project configuration file; Add the on-demand loading configuration information of the target component in the configuration sub-file to load the specified component included in the target component in the basic front-end project; Among them, the attribute script field is a field type in the project configuration file, each attribute thereof corresponds to a script, the configuration sub-file is a configuration file including all configuration data of the custom configuration file, and the on-demand loading configuration information is configuration information used to load the target component on demand.

2. The method according to claim 1, characterized in that The basic front-end project is built and started through the target front-end project development tool, including: Build the scaffolding of the basic front-end project through the front-end project creation command; Download and install the project template of the basic front-end project in the scaffold through a project template creation command; Enter and start the basic front-end project through the project entry command and project start command.

3. The method according to claim 1, characterized in that Adding a style development tool to the basic front-end project includes: Install the style development tool in the basic front-end project through a style development tool installation command; Insert the style development tool into the project configuration file of the basic front-end project through a style development tool insertion command; A tool configuration file of the style development tool is generated by a configuration file generation command.

4. The method according to claim 3, characterized in that Also includes: Insert a prefix auxiliary plug-in tool into the project configuration file of the basic front-end project through a prefix auxiliary plug-in tool insertion command; The prefix auxiliary plug-in tool is used to automatically complete the associated prefixes of the browser.

5. The method according to claim 1, characterized in that The target front-end project development tool includes React, the style development tool includes Tailwindcss, and the target component includes antd component.

6. A front-end development device, characterized in that: include: The basic front-end project startup module is used to build and start the basic front-end project through the target front-end project development tool; A style development tool adding module, used to add a style development tool to the basic front-end project; A style development module, used for developing styles in the web pages of the basic front-end project by using the style development tool; The front-end development device also includes a target component determination module, which is used to: Component management system tools to identify target components; Obtain the target component from the component management system tool through a target component installation command, and install the target component in the basic front-end project; Modify the entry file of the basic front-end project to add the style folder of the basic front-end project to the entry file; Add the component style folder of the target component to the style folder of the basic front-end project; The target component determination module is specifically used for: Install the custom configuration file in the basic front-end project through the custom configuration file installation command; Modify the property script field of the project configuration file in the basic front-end project; Create a configuration subfile of the custom configuration file in the root directory of the project configuration file; Add the on-demand loading configuration information of the target component in the configuration sub-file to load the specified component included in the target component in the basic front-end project; Among them, the attribute script field is a field type in the project configuration file, each attribute thereof corresponds to a script, the configuration sub-file is a configuration file including all configuration data of the custom configuration file, and the on-demand loading configuration information is configuration information used to load the target component on demand.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the front-end development method described in any one of claims 1-5.

8. A computer storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the front-end development method described in any one of claims 1-5 when executed.