By Mozai (from Youpinjie) and Suchuan (from F(x) Team)
Youpinjie is an application offering regionalized city life services. It provides users with information services, such as merchant information, consumer reviews, short video shooting, and discounts.
Designers use design material management, design layer marking, layer parsing, and other capabilities to collaborate with frontend developers efficiently. The collaboration efficiency has been improved.
imgcook created more than 1,100 modules from May 25, 2020, to June 3, 2021, covering over 20 frontend projects.
imgcook helps frontend developers accurately restore design drafts. Parameters can remain consistent between design drafts and frontend codes, including font size, color, and line spacing between modules. imgcook helps reduce unnecessary communication between designers and frontend developers and helps improve frontend productivity with its automatic code generation.
Designers can upload design materials in the imgcook background. Other designers of the same team can use the imgcook sketch plug-in to share a set of design materials. This will ensure a unified and standardized design.
When generating the code, a unified and standardized design draft can make the generated code more maintainable.
Name the design draft based on the official documentation of design materials. In Sketch, the catalog is divided based on the name.
The grouping protocol is used here. The files will be grouped first. Then, the grouping protocol will be added. A nested structure will be generated according to #group# during code generation. The generated code structure is the self-defined nested structure. imgcook can also automatically generate an acceptable nested structure.
Designers are familiar with Sketch. However, they still need to understand a little about the hierarchy of frontend code. If there are no redundant layers, the automatically generated structure is acceptable. As a result, this operation is not used often.
When we design the visual draft, a picture will be composed of many layers. However, only one picture is allowed in the frontend code, such as the download icon. imgcook provides a design draft protocol that can add a #merge# tag to the folder composed of multiple layers for merging. This way, only one picture will be generated when exporting.
According to the development requirements, a semantic name is added to the layer. The frontend developers can use it as the class name. Designers may find this easy to understand. We have added class names to this component, so we don't need to add them again when using these design materials.
In addition, we can add class name prefixes:
Set the format of exported images according to the Advanced Marking Specification for Design Draft. This is widely used by designers because they have special requirements for the image format of online pages.
Create a design group in imgcook and upload the sketch file according to the document:
After uploading the materials, you need to switch to your design group in the Settings. Then, you can drag the materials directly to use. If materials are not updated, you can right-click to reload.
When designing the page, the design draft will also be processed the same way as the design materials.
After the design is completed, you can parse the design draft to generate a link and send it to the frontend developers.
Frontend developers can click the link to view the code.
Copy or export the code to the local project in the imgcook editor.
We officially recommend using imgcook cli and plug-in to directly import the generated code to the project using the command line.
imgcook allows users to upload personal design materials. This is suitable for teams with specific design specifications and components. On the one hand, it facilitates design collaboration, and on the other hand, it can standardize and unify the design specifications of the team.
In terms of code generation, layer tags required by developers can be uniformly added during material design, such as class name prefixes and image formats. Designers on the team do not need to care about these when designing UI. After UI design is completed, the exported code will have a unified and standard class name prefix and expected image format.
In other words, the management capability of design materials standardizes the design input of code generation. At the same time, it completes layer marking during material design with the minimum cost for code generation with customized requirements, such as class name prefixes and image formats.
imgcook exports the design draft as PNG images by default, but we expect it to be of the SVG format. In addition, frontend developers expect the exported code to have a business-related class name prefix. In some scenarios, imgcook cannot solve some problems, such as the background image composed of multiple layers. We need to manually mark the layers with the #merge# protocol provided by imgcook. Then, we can export it as one image.
Generally, in some scenarios where imgcook cannot meet our requirements for automatic code generation, we can manually mark the design draft as described in Advanced Marking Specification for Design Draft. This way, highly maintainable code can be generated in these scenarios.
The marking protocols commonly used include those for:
Copy or export code from the imgcook editor
imgcook is a platform that intelligently generates code based on the design draft. It was developed and opened by Alibaba. It can generate maintainable frontend code for React, Vue, and mini programs based on design drafts (Sketch/PSD/Figma/images). It can also customize the generated code.
We can install Sketch, Photoshop, and Figma plug-ins to export layer data to imgcook or upload design draft files directly in the imgcook editor for parsing. Then, we can view the generated code in the imgcook editor.
You can share some examples showing how other teams are using imgcook. More examples will be given on the imgcook official website.
imgcook can automatically generate code with high maintainability, but the design draft layers are ever-changing, and some scenarios have not been covered. For example:
imgcook provides a design protocol to solve these problems. It allows users to manually intervene in layers. Users can also make visual adjustments in the imgcook editor after the code is generated.
For more information, please visit the official site of imgcook: https://www.imgcook.com/
AI Application Scenarios and Implementation Practices in Draft Design Generation Code
66 posts | 3 followers
FollowAlibaba F(x) Team - June 20, 2022
Alibaba F(x) Team - March 3, 2021
Alibaba F(x) Team - September 30, 2021
Alibaba F(x) Team - February 25, 2021
Alibaba F(x) Team - December 30, 2020
Alibaba F(x) Team - December 8, 2020
66 posts | 3 followers
FollowA low-code development platform to make work easier
Learn MoreHelp enterprises build high-quality, stable mobile apps
Learn MoreAlibaba Cloud (in partnership with Whale Cloud) helps telcos build an all-in-one telecommunication and digital lifestyle platform based on DingTalk.
Learn MoreMore Posts by Alibaba F(x) Team