Speeding Up Development with Figma-to-code through Plasmic
Tags: react, figma, plasmic, nocode
Published: 2022-02-04 09:34:12

Visual web development software and no-code solutions for building static webpages are not exactly new inventions. While no-code has many pros - especially for people or companies with simple requirements and low budgets - it can also be very limiting, and it often doesn't fit well into the development of a complex dynamic site, especially if development has already begun.

Many of the older no-code solutions are also not very performant nor expensive. 

There are newer no-code tools which are more performant and are able to work more seamlessly with classic web development and hosting (webflow.com for example), but if you're reliant on a lot of custom or legacy code, or want to integrate no-code into your own dev-ops environment, Plasmic might be a solution. And a fast one at that. 


## What is Plasmic?

Plasmic is a no-code, collaborative visual builder for the web. 

You can build pages or components and either let Plasmic host them (which is great for quick changes, or for letting  an admin change Landing pages etc.), or generate REACTJS code.

With the latter approach, Plasmic is free to use and easy to integrate into a pre-existing project. 

On top of that, Plasmic has created and maintains the [Figma-to-Code](https://www.figma.com/community/plugin/845367649027913572/Figma-to-Code-by-Plasmic ) plugin, which can greatly speed up the development of components. 


## A micro example

In the following simple example, a "designer" has requested the development of this simple page as an extension to a large, pre-existing project.
 ![The page in figma](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6dec46ejrbpaopwqqsrr.PNG)
 
The page consists of a couple of SVG files, some text and some buttons. 

With the Figma-to-Code plugin, you can copy and paste the entire page into Plasmic.

![Using the plugin](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ueoa9c90cq6gkx2y9fiv.PNG)

![The page in plasmic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5iwopgqxshk2tlh0c5e9.PNG)
  


More practically, you can copy and paste both of the components into their own Plasmic components.

![Earth component](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fa0rsm91nzdmwjnqyce1.PNG)

From here, it's possible to make variants of each component; these variants can be interaction variants, such as Hover, Press etc. 

![Variants of component](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jkknewk95udgq94rahdz.PNG)
 
And now, to my favorite part. 

By pressing the publish button in the top right, you can connect the project to a github project (or other git projects) and automatically generate the components - ready for use. 

![Publishing](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhe2847o6kh8ccfhkaci.PNG)
 
It's even possible to trigger other CI-CD pipelines to automate deployment or testing. 

The generated view components will be put in a components/plasmic folder, and in the components folder you will find newly generated "skeleton" components that you can use to add any wanted functionality into.

Voilá

![The list of generated components](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vg0i1lc906m7noq39ql3.PNG)

## Things to be mindful of
 
The entire process, from Figma to code, can take minutes, or seconds, if there are no large adjustments needed. 

Many Figma projects created by designers are not necessarily that easy to import. 

Masked components are buggy, and it isn't easy to make good, responsive flexbox designs if the designer doesn't use auto-layout or just manually enters padding per component. 

I also have to mention that Plasmic is not the only visual component creator tool, but the addition of the collaboration tools and deployment make it a powerful tool for fast development of visual components.

Resources: 

[plasmic](https://www.plasmic.app/)
[Figma-to-Code](https://www.figma.com/community/plugin/845367649027913572/Figma-to-Code-by-Plasmic )