All Projects → inthepocket → hubble-scripts

inthepocket / hubble-scripts

Licence: MIT license
🔭 📜 Transform Sketch config data & assets into dev-friendly formats.

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to hubble-scripts

open design system
Open Source Design System using Sketch. It's early days of my project.
Stars: ✭ 22 (-4.35%)
Mutual labels:  sketch-app, design-system
Sketch Lint
Check the compliance of your design guidelines within seconds
Stars: ✭ 291 (+1165.22%)
Mutual labels:  sketch-app, design-system
Overrideit Sketchplugin
Overrideit is sketch plugin that allow designers to search in overridelist and overrides dropdowns, and with many other features.
Stars: ✭ 113 (+391.3%)
Mutual labels:  sketch-app, design-system
shared-react-components-example
An example of a mono-repository of shared React components libraries!
Stars: ✭ 85 (+269.57%)
Mutual labels:  design-system
ACCESS-NYC-PATTERNS
ACCESS NYC Pattern library and design system documentation for https://access.nyc.gov. Maintained by @NYCOpportunity
Stars: ✭ 14 (-39.13%)
Mutual labels:  design-system
gql-sketch
💎 minimal graphql client for Sketch
Stars: ✭ 29 (+26.09%)
Mutual labels:  sketch-app
big-design
Design system that powers the BigCommerce ecosystem.
Stars: ✭ 35 (+52.17%)
Mutual labels:  design-system
8 bit hubble
Generate random pixel art galaxies! In honor of Hubble Space Telescope, SNES videogames and Bob Ross
Stars: ✭ 59 (+156.52%)
Mutual labels:  hubble
GEL
The Design System and supporting website for Westpac GEL
Stars: ✭ 23 (+0%)
Mutual labels:  design-system
react-uswds
USWDS 3.0 components built in React
Stars: ✭ 108 (+369.57%)
Mutual labels:  design-system
uinix-ui
A minimal framework-agnostic and configurable UI system to build UI systems. Your system your rules 🤘.
Stars: ✭ 19 (-17.39%)
Mutual labels:  design-system
bezier-react
React components library that implements Bezier Design System.
Stars: ✭ 85 (+269.57%)
Mutual labels:  design-system
base-design-docs
A documentation site for the Base design system.
Stars: ✭ 22 (-4.35%)
Mutual labels:  design-system
core
The Pangolin.js core that drives everything.
Stars: ✭ 18 (-21.74%)
Mutual labels:  design-system
Sketch-PageNumbers
Sketch plugin for adding page numbers to artboards.
Stars: ✭ 27 (+17.39%)
Mutual labels:  sketch-app
sketch-action-api-tester
A plugin to listen to all the events in the Action API
Stars: ✭ 26 (+13.04%)
Mutual labels:  sketch-app
design-system
Nulogy Design System
Stars: ✭ 61 (+165.22%)
Mutual labels:  design-system
clj-gcloud-storage
Clojure wrapper for google-cloud-storage Java client.
Stars: ✭ 20 (-13.04%)
Mutual labels:  google-cloud-storage
designDoc
A lean product design process in markdown that enables cross-functional teams to take an idea from napkin to scale by prioritizing learnings to produce customer-centered solutions.
Stars: ✭ 28 (+21.74%)
Mutual labels:  design-system
rebass
⚛️ React primitive UI components built with styled-system.
Stars: ✭ 7,844 (+34004.35%)
Mutual labels:  design-system

Hubble OSS

LICENSE Platform Releases Last commit Latest release CI Status

hubble-scripts

Scripts repository to export design data like colors, fonts & text, and map them to design tokens.

The backbone of the Hubble ecosystem, this scripts repository exports design data like colors, fonts & text, and maps them to JSON design tokens to integrate in your applications. This repository is an attempt to further automate design systems & tooling at In The Pocket. Assets can also be exported as platform-friendly PNG & SVG formats.

Contents

Prerequisites

For parsing Sketch:

  • A recent bash version ([email protected] recommended)
  • macOS with Sketch 60+ (latest Sketch recommended)

For parsing Figma:

For parsing Adobe XD:

  • Recent version of Adobe XD

Installing

The easiest way to install is to download one of the releases and download the hubble-cli binary. This can be executed by most shells and will only output design tokens.

Sketch

If you're looking to also export assets for Sketch, download sketchtool.sh, which is a shell script wrapper around Sketch's sketchtool binary.

Usage

There is a sample .sketch file, .xd file and Figma file ID in the mocks folder with sample output that would be generated for this file.

hubble-scripts works best with a separate Sketch, Figma or Adobe XD library file. Take a look at the examples and short bits below, or refer to our the relevant documentation for your design tool.

Generating JSON config

You can use the hubble-cli binary to export design data out of your file and map it to a generic JSON design token format.

# This will generate a `hubble-data.json` file with text styles & colors found in a Sketch document:
$ ./hubble-cli "__mocks/sketch/sample_sketchfile.sketch"
$ ./hubble-cli --token "29-206..." HbgJuBVOwIOcoZMVnpG01LqA

# You can optionally specify a config output dir. Otherwise current working directory will be used:
$ ./hubble-cli "__mocks/sketch/sample_sketchfile.sketch" --outputDir="/var/hubble/"
$ ./hubble-cli "__mocks/sketch/sample_sketchfile.sketch" --outputDir="/var/hubble/"

If you need more fine-tuning over this export flow, Hubble provides even more options to customize your design token output.

Style Dictionary

hubble-scripts supports a variant on our default generic design tokens, which is compatible with the Style Dictionary build system. By taking advantage of Style Dictionary's structure, we can slot in their existing transformers to output to various platforms or languages.

For more information on our Style Dictionary output, check the wiki.

Exporting assets

Sketch

Assets can be exported using the sketchtool.sh script. This process exports all layers marked as exportable or that have been sliced.

# This will export normalized (lowercase, underscore) assets as SVG (for web) and PNG (1x, 2x, 3x for native)
$ ./sketchtool.sh "__mocks/sketch/sample_sketchfile.sketch"

# You can optionally specify an asset output dir. Otherwise current working directory will be used:
$ ./sketchtool.sh "__mocks/sketch/sample_sketchfile.sketch" "/var/hubble/assets/images"

Figma

TODO:

Adobe XD

Please see the Caveats

Integrating in a project

Copy hubble-cli and sketchtool.sh to a scripts folder in your project. This example uses npm run-tasks to describe the export flow:

{
  "scripts": {
    "hubble:tokens": "./scripts/hubble-cli ...",
    "hubble:assets": "./scripts/sketchtool.sh ...",
    "hubble": "npm run hubble:tokens && npm run hubble:assets"
  }
}

Contributing

We appreciate every form of contribution, but before you contribute please make sure you have read the contribution guidelines

Development

hubble-cli is a compiled binary of cli.js, a Node.js CLI wrapper around our index.js script. If you have Node you can run this script directly:

$ node cli.js --help

  Usage
    $ hubble-cli <input> [options]

  Options
    --outputDir=<dir>, -o           The directory where parsed files will be placed after a run. Defaults to current working directory.
    --useStyleDictionaryOutput, -s  Generate Style Dictionary compatible output instead of the generic design token format.
    --dump, -d                      Generate a raw JSON dump from your design parser, before Hubble exports its tokens

  Options: Sketch
    --useColorArtboards             Use artboard formatting to export colors instead of using the document colors.
    --useGradientArtboards          Use artboard formatting to export gradients instead of using the document gradients.
    --ignoreTextStylePaths          Textstyles that use slashes to enable navigation in Sketch will be ignored
                                    and their id will be the first part of the path.

  Options: Figma
    --token, -t                     Authorization token when accessing the Figma API.
    --exportAssets, -e              Export assets from Figma.

  Examples
    $ hubble-cli "__mocks/sample_sketchfile.sketch"
    $ hubble-cli "__mocks/sample_sketchfile.sketch" -d --useColorArtboards --outputDir="config/"
    $ hubble-cli --token "29-206..." HbgJuBVOwIOcoZMVnpG01LqA
    $ hubble-cli --token "29-206..." HbgJuBVOwIOcoZMVnpG01LqA --useStyleDictionary

For more on running in development mode, check the [wiki].

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].