Skip to content

Documentation for Zeplin extensions βš—οΈπŸ“š

Notifications You must be signed in to change notification settings

zeplin/zeplin-extension-documentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

64 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Zeplin Logo

Zeplin Extension Documentation βš—οΈπŸ“š

Zeplin extensions are JavaScript modules that generate code snippets from various design elements. All code snippets you interact with in Zeplin are generated using extensions and they're curated at extensions.zeplin.io.

If you're interested in developing your own Zeplin extension, this documentation covers the basics of building one along with a tutorial and discusses their capabilities. Ping us at [email protected] if you have any questionsβ€”we'd love to hear what you're building!

If you just want to try out extensions and ended up here by mistake, head to extensions.zeplin.io to browse them.

What is an extension?

CSS extension

Extensions are JavaScript modules that implement various functions to generate code snippets from models.

In the example above, Zeplin invokes the layer function of the extension, passing the selected layer object as a parameter. Returned value is then displayed. Code highlighting is performed by Zeplin, extensions only communicate the preferred language.

Getting started

zem, Zeplin extension manager, is a command line tool that lets you quickly create, test and publish extensions.

If you have npm 5.2+ installed, you can run zem directly to create one:

npx zem create my-extension

Under my-extension, zem will generate the initial project structure:

my-extension
β”œβ”€β”€ README.md
β”œβ”€β”€ package.json
└── src
    └── index.js

index.js

Default entry point for the extension, a JavaScript document that exports functions, corresponding to different actions. To name a few:

  • colors: Generates snippets from Project or Styleguide colors.
  • layer: Generates snippets from the selected layer.
  • screen: Generates snippets from the screen.
  • component: Generates snippets the selected component.

See Extension documentation for all the functions and their details.

package.json

npm's package.json defines everything you, and Zeplin, need to know about an extension, along with its dependencies.

Apart from basic information like name and description, under the zeplin key, extensions can also define options.

See package.json documentation for details.

Running an extension

zem lets you run an extension in the command line, during development. You can execute functions with sample data and observe the results, without running the extension inside Zeplin.

To learn more about zem and the exec command, see documentation.

Your first extension

We've prepared a tutorial to guide you through your first Zeplin extension, dive in:

πŸŽ“ View tutorial

Models

Quickly jump to the documentation of a particular model to learn more about it.

Publishing an extension

When you're ready, zem lets you publish an extension to extensions.zeplin.io. Publishing an extension will submit it for review and you'll be notified via email once the extension is listed.

To learn more about zem and the publish command, see documentation.

Examples

Stylesheet

zeplin/stylesheet-extensions

Official stylesheet extensions used in Zeplin are open source, collected under a monorepo, generating CSS, Less, SCSS, Sass, Stylus snippets from colors, text styles and layers.

All stylesheet extensions make use of a package called zeplin-extension-style-kit that extracts CSS-like style properties from design elements. If you're building an extension that generates CSS-like snippets, like a preprocessor or a CSS-in-JS solution, zeplin-extension-style-kit should get you halfway there.

React Native

zeplin/react-native-extension

Official React Native extension used in Zeplin is open source. It's a full-fledged extension example, generating React Native JavaScript snippets from colors, text styles and layers.

Although it's an ideal candidate, currently React Native extension isn't built upon zeplin-extension-style-kitβ€”we're on it!

About

Documentation for Zeplin extensions βš—οΈπŸ“š

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published