All Projects β†’ omaralbeik β†’ SketchGen

omaralbeik / SketchGen

Licence: MIT license
A Swift command line tool for generating source code from sketch files

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
CSS
56736 projects
Makefile
30231 projects

Projects that are alternatives of or similar to SketchGen

markyp-bootstrap4
Create Bootstrap 4 web pages using purely Python.
Stars: ✭ 19 (-29.63%)
Mutual labels:  code-generator, templating
Sketchtoswift
πŸ“² Generate Swift from Sketch
Stars: ✭ 251 (+829.63%)
Mutual labels:  code-generator, sketch
Smile-Sketch
ζ–‡ζ‘£εΏ«ι€Ÿζ•΄η†ζŽ’εΊοΌŒθ΅„ζΊε―Όε…₯δΈŽε―Όε‡Ί
Stars: ✭ 14 (-48.15%)
Mutual labels:  sketch
code-generator
Web Application to generate your training scripts with PyTorch Ignite
Stars: ✭ 30 (+11.11%)
Mutual labels:  code-generator
symbol-insert
A simple plugin to insert your Sketch symbols
Stars: ✭ 25 (-7.41%)
Mutual labels:  sketch
DesignToken2Code
Convert design tokens to SCSS variables as code
Stars: ✭ 16 (-40.74%)
Mutual labels:  sketch
design-tokens-plugin
Support end of life! Delivering consistent Design System. A Sketch plugin that exports Design Tokens to JSON format. You can export colors, typography, icons and utilis. A must-have tool for design system project.
Stars: ✭ 100 (+270.37%)
Mutual labels:  sketch
Sketch-SelectPlus
Sketch plugin to select different layers of specific types. It basically selects everything!
Stars: ✭ 20 (-25.93%)
Mutual labels:  sketch
open design system
Open Source Design System using Sketch. It's early days of my project.
Stars: ✭ 22 (-18.52%)
Mutual labels:  sketch
vgg runtime
VGG Runtime for loading and running designs as apps.
Stars: ✭ 19 (-29.63%)
Mutual labels:  sketch
gondul
Network management/monitoring system specialized for temporary events
Stars: ✭ 40 (+48.15%)
Mutual labels:  templating
core
An advanced and highly optimized Java library to build frameworks: it's useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more...
Stars: ✭ 100 (+270.37%)
Mutual labels:  code-generator
SketchSVG
Have icons in a Sketch file but don't want to manually extract and compress them as SVGs? Let our SketchSVG tool do it!
Stars: ✭ 23 (-14.81%)
Mutual labels:  sketch
framework
Cygnite PHP Framework- A Modern Toolkit For Web Developers
Stars: ✭ 43 (+59.26%)
Mutual labels:  code-generator
damascus
βš”οΈ CRUD boilerplate generator for Liferay DXP
Stars: ✭ 51 (+88.89%)
Mutual labels:  code-generator
Sketch-Keyboard-Resize
A Sketch plugin that lets you resize objects from all sides with keyboard shortcuts. As a bonus you can specify the resize amount.
Stars: ✭ 16 (-40.74%)
Mutual labels:  sketch
qaz
qazβ€”A CLI tool for Templating & Managing stacks in AWS Cloudformation
Stars: ✭ 89 (+229.63%)
Mutual labels:  templating
button-text-card
Custom, "neumorphism" Lovelace card
Stars: ✭ 95 (+251.85%)
Mutual labels:  templating
ardielle-tools
No description or website provided.
Stars: ✭ 17 (-37.04%)
Mutual labels:  code-generator
AODA
Official implementation of "Adversarial Open Domain Adaptation for Sketch-to-Photo Synthesis"(WACV 2022/CVPRW 2021)
Stars: ✭ 44 (+62.96%)
Mutual labels:  sketch

SketchGen is a command line tool written in Swift that generates source code from sketch files.

Features

  • βœ… Extract assets from a Sketch file including:
    • ➑️ colors (RGBA and HEX)
    • ➑️ shadows
    • ➑️ fonts
    • ➑️ borders
    • ➑️ radius values
  • βœ… Multi-page Sketch file parsing
  • βœ… Extract assets into a simple JSON file for easier interaction with other 3rd party tools
  • βœ… Generate Readable, snake_cased, and camelCased, UPPERCASED, lowercased, and Capitalized names
  • βœ… Use a templating system to generate source code for any programming language using your preferred style
  • βœ… Generate from anywhere including Linux and on CI

tl;dr

SketchGen + Example/styles.sketch + Example/templates = Example/generated

After installation

git clone [email protected]:omaralbeik/SketchGen.git
cd SketchGen

sketchgen generate -s Example/styles.sketch ~/Desktop/Output Example/templates -v

open ~/Desktop/Output

Check generated source code in Desktop/Output

Installation

Homebrew (recommended)

brew tap omaralbeik/formulae
brew install sketchgen

Mint

mint install omaralbeik/SketchGen

Make

git clone https://github.com/omaralbeik/SketchGen.git
cd SketchGen
make install

Swift Package Manager

Use as CLI

git clone https://github.com/omaralbeik/SketchGen.git
cd SketchGen
swift run sketchgen

Use as dependency

Add the following to your Package.swift file's dependencies:

.package(url: "https://github.com/omaralbeik/SketchGen.git", from: "0.1.0"),

And then import wherever needed: import SketchGen

Usage

Parse a Sketch file

sketchkit parse <.sketch file path> <destination path>

# Example:
## Parse a a file named styles.sketch in Desktop and create a context.json in Desktop
sketchkit parse ~/Desktop/styles.sketch ~/Desktop

Generate source code

From .sketch file

sketchkit generate -s <.sketch file path> <destination path> <templates folder path>

# Example:
## Parse a file named styles.sketch in Desktop and create source code
## in Desktop/generated, using templates in /Desktop/templates folder:
sketchkit generate -s ~/Desktop/styles.sketch ~/Desktop/generated ~/Desktop/templates

From pre-generated context.json file

sketchkit generate -c <context.json file path> <destination path> <templates folder path>

# Example:
## Parse a context file named context.json in Desktop and create source code
## in Desktop/generated, using templates in /Desktop/templates folder:
sketchkit generate -c ~/Desktop/context.json ~/Desktop/generated ~/Desktop/templates

Flags

-v --verbose Log tech details for nerds
-h --help Show help information

A word about conventions in your Sketch file

SketchGen expect the followingin your Sketch file:

  • Sketch file with 1 or more pages
  • Each page should have 1 or more artboards
  • Each artboard should have exactly 1 rectangle or text layer
  • layer names can have only english letters, numbers and _ and follow the following conventions:
Layer Type Prefix Examples of Valid Names
Color gen_color_ gen_color_primary, gen_color_dark_blue
Shadow gen_shadow_ gen_shadow_small, gen_shadow_extra_large
Font gen_font_ gen_font_body, gen_font_heading_1
Border gen_border_ gen_border_small, gen_border_extra_large
Radius gen_radius_ gen_radius_small, gen_radius_extra_large

See Example/styles.sketch for an example.

Source code templates

Templates are written in Stencil templating language.

On top of Stencil's built-in filters, snakecased and camelcased filters are added for more flexible source code generation.

See Example/templates for examples for Swift, ObjC, CSS, and XML templates.

Attributions

This tool is powered by

Thanks

License

SketchGen is released under the MIT license. See LICENSE for more information.

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].