This repo is a work in progress, and it's not ready for the prime time, but if you want to use it you can!
This plugin exports a simple website using a bunch of conventions and one or many Figma documents as the structure. We named the plugin "design doc" because initially, we used it to export a design guideline, but we have been using it for many other things.
If you want to see an example, you can build this website using this Figma files as a base.
- You need RUBY to run this project. We recommend installing rbenv for handling multiple versions. Make sure that at the end of the process you have ruby and gem installed. Gem is being shiped since version 1.9.
You can check it by running
ruby -v
andgem -v
in the terminal. - Go to a library that is not the project library and install bundler. Run
gem install bundler
. Make sure it is available by runningbundle -v
. More information
- Fork this repository
git clone https://github.com/mamuso/figma-designdoc.git
- Get your Figma Personal Access Token
- Create a
.env
file in the root directory. - Copy your token that you've created in the first step to
.env
in the following way:
FIGMATOKEN=xxxx-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
-
If you would like to keep it in the repository and you don't mind exposing your token you could add it to
_.config.yml
as well. -
As a next step you need to add your document id to the
document
section. For getting the ID you have to go to FIGMA. Select a document. You are now redirect to the editor. The url should look similar to this:https://www.figma.com/file/LS5LEaS634ZITxOpSpDBXEeG/
Copy ID that you see after the/file/
part and place it documents like this:document: LS5LEaS634ZITxOpSpDBXEeG
.
figmaconfig:
# we recommend to store your figma token in a .env ignored file
token:
xxxx-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# scale corresponds with the scale parameter of https://www.figma.com/developers/docs#images-endpoint
# value: from 0.01 to 4. We recommend 2 for crispy images on retina displays
scale: 2
format: png
figmaurls: true
home: true
documents:
- document: LS5LEaS634ZITxOpSpDBXEeG
category: Components
- Installing dependencies
bundle install
- Running a temporary server or creating a build.
bundle exec jekyll serve
bundle exec jekyll build
The project uses Jekyll and the Figma Web API to build a static site that you can deploy to your favorite hosting service.
We use custom plugins and Jekyll::Hooks
, so we can't make it work as a Github Pages branch, but you can generate the site locally or with a CI system and push the result to your repository.
- When you have
xz
installednokogiri
might fail to install. Solution:
brew unlink xy
bundle install
brew link xy
- When you run the project it might take a while to download all the assets please be patient.