How to get started?
If you are a designer without experience in developing, the first thing you should know, in general, is to read the documentation. As I said before, nothing of this would be possible without the amazing efforts of Airbnb, so I highly recommend to review the official GitHub repository here.
Besides the information you can find there, it’s important to understand how this works. This is not a plugin for Sketch. The idea is simple. With this tool, we use React to generate the design in Sketch, doing that, Sketch turns into just a way to render what React has coded. I know what you’re wondering. Why is this necessary? We will get to that in a bit.
Let’s get started! First, we need to install it. The repository has the necessary instructions to download the examples they have there, but if you want to start a new project from scratch, here are the instructions:
- After you’ve download the repo in your computer. Go to the examples folder and copy the content in another folder with the name of your project. I recommend to use the Styleguide example, it has the basic structure based on what I’m working on.
- Create a new sketch file and save it there, inside that folder. It doesn’t matter the name, or if it doesn’t has something designed inside (it’s going to be deleted anyway).
- Go to your console and then go to the project’s directory. If you’re a beginner coder, you can use the Terminal or iTerm2, then run the following commands. In this case I have a folder called “Code” where I have all my projects, the project I’m using for this example is called “loginProject”, so the commands to run will look like:
4. With all the Node dependencies installed. Open the file “styleguide.sketchplugin”. This file will install the necessary connections in Sketch, to tie with your React code.
5. Open the Sketch file you’ve created at the beginning, then go to your plugins tab and select the new one that should appear there. Doing that, should appear an option to run it:
6. And finally, if you want to see how the example looks like, go back to your console (be sure you’re inside your directory) and type:
You will see how your Sketch file has been updated with the Styleguide elements of the example, all what you’re seeing has been generated by the React code. If you don’t have too much experience with Javascript and/or React, the generation of this content can be a little overwhelming if you check the code, but don’t worry about that for now.
NOTE: If you still don’t have a code editor. Atom is a really good and nice option, it has a pretty decent UX.
7. All the work we are going to do, will be performed only in the “src” folder. So go there and delete:
- All the files inside the components folder.
- If you’re using another example as a base, delete all the files except:
designSystem.js
main.js
manifest.json
processColor.js
There are 2 files that are really important and you should know their function:
designSystem.js
This file will contain all the reusable properties. Mainly: Colors and Typographies styles. For example, if in the future you want to update a color, this is the place to do it (and it will be changed in all your components!).
main.js
This file is the main connection with Sketch, so everything will be exported from here. To start from scratch go there and delete all the code.
And now… let’s make a pause.