Skip to content
Gett's Design System code generator. Use Zeplin Styleguides as your R&D's Single Source of Truth.
Swift Ruby Makefile
Branch: master
Clone or download

Latest commit

freak4pc Recursively fetch all results for a given resource
The Zeplin API provides results limited to 100 per page, which means we have to perform multiple requests for resources which have more than 100 records. For example a project withh 150 text styles, etc.
Latest commit 5790345 Apr 2, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows GitHub Actions for PRs Mar 19, 2020
Assets README: Add template GIFs Feb 24, 2020
Documentation Conditionals, generalize blocks, support inline-blocks Feb 24, 2020
Examples Add SwiftUI Example Mar 1, 2020
Helpers More cleanups, suppress non-core warnings Dec 21, 2019
Sources Recursively fetch all results for a given resource Apr 2, 2020
Tests Letter Spacing & Line Height rounding (#15) Mar 20, 2020
bin Recursively fetch all results for a given resource Apr 2, 2020
.gitignore Use new Zeplin Private Beta API Dec 15, 2019
.swiftlint.yml Update file headers Dec 6, 2019
Gemfile Prism cleanup Dec 6, 2019
Gemfile.lock Prism cleanup Dec 6, 2019
LICENSE.md Add MIT License Feb 24, 2020
Makefile Recursively fetch all results for a given resource Apr 2, 2020
Package.resolved Migrate to ArgumentParser [swift-argument-parser] Feb 28, 2020
Package.swift Letter Spacing & Line Height rounding (#15) Mar 20, 2020
README.md Prism 0.2 Mar 20, 2020
codecov.yml Ignore Tests folder for Codecov Dec 15, 2019

README.md

Prism: Design System Code Generator logo
Build Status Code Coverage for Prism on codecov Swift Package Manager Support

Prism is a Design System code generator developed by the team at Gett 🚕.

Synchronizing design teams with engineering teams is a huge challenge.

As teams scale, new growing pains start around how to properly align colors, text styles and other design details between teams, in a uniform way, from a single source of truth.

Prism was built to solve this very problem! It takes a Zeplin project as input, and generates any output code you want from a project's styleguide based on a set of templates in your project, resulting in cross-platform code that is always synchronized from a single source-of-truth (Your project's Zeplin Styleguide).

Prism is especially useful when used in your CI/CD process to remove the friction of design handoff and review, and making sure all of your teams are properly synchronized in regards to naming, values, and more.

Getting Started

📹 Videos

🌈 Getting Prism

There are four options to install prism:

  1. Install with Homebrew: brew install GettEngineering/tap/prism
  2. Install using Mint: mint install GettEngineering/Prism
  3. Build from source: make install
  4. Run directly with SPM: swift run prism generate

🔑 Getting a Zeplin API Token

To use Prism, you'll need to generate a Personal Access Token (JWT) to Zeplin's API by going to https://app.zeplin.io/profile/developer and click the Create new token button in the Personal access tokens section:

Generating a Zeplin Personal Access Token

You'll need to expose this token to run the prism CLI tool. Make sure you have a ZEPLIN_TOKEN environment variable with your token configured.

When running prism in a CI environemnt, we recommend adding ZEPLIN_TOKEN as an Environment Secret.

When using prism locally or bootstrapping your project for the first time, you can simply run export ZEPLIN_TOKEN='zeplin_personal_token' before running prism locally.

👢 Bootstrap Prism for your Project

Inside your project folder, run prism init.

It will guide you through selecting a Zeplin project as source along with other useful information for proper code generation. Once prism init is successful, you'll find a new .prism folder with a config.yml file outlining your preferences.

🎨 Creating Templates

Prism uses templates with the .prism suffix located in your project's .prism folder. These Prism templates are basically plain text files — Prism doesn't really care what format or language you use, it can make any kind of output as long as you can express it in a Prism template file.

Prism looks for something called Tokens inside your templates. These tokens follow the following format: {{%token%}}. You can find a couple of sample templates in the Examples folder.

Here are two short example of generating colors code for iOS and Android using Prism templates.

Colors.swift.prism:

Color.swift iOS Prism Template

colors.xml.prism:

Color.swift Android Prism Template

Development

  • Run make or make install to build a release binary of the prism CLI tool and install it to /usr/local/bin.
  • Run make build to build a release binary of the prism CLI tool
  • Run make project to create an Xcode project and start working.
  • Run make test to run all tests.
  • Run make clean to clear the generated Xcode project.
You can’t perform that action at this time.