{"id":17133426,"url":"https://github.com/omaralbeik/sketchgen","last_synced_at":"2025-04-13T08:11:50.270Z","repository":{"id":95950827,"uuid":"237980461","full_name":"omaralbeik/SketchGen","owner":"omaralbeik","description":"A Swift command line tool for generating source code from sketch files","archived":false,"fork":false,"pushed_at":"2020-02-15T10:31:20.000Z","size":193,"stargazers_count":26,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T14:53:56.416Z","etag":null,"topics":["cli","code-generator","parser","sketch","swift","templating"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omaralbeik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-03T14:10:06.000Z","updated_at":"2024-06-05T09:31:41.000Z","dependencies_parsed_at":"2023-05-20T05:02:43.408Z","dependency_job_id":null,"html_url":"https://github.com/omaralbeik/SketchGen","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaralbeik%2FSketchGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaralbeik%2FSketchGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaralbeik%2FSketchGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaralbeik%2FSketchGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omaralbeik","download_url":"https://codeload.github.com/omaralbeik/SketchGen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681497,"owners_count":21144700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","code-generator","parser","sketch","swift","templating"],"created_at":"2024-10-14T19:42:09.095Z","updated_at":"2025-04-13T08:11:50.243Z","avatar_url":"https://github.com/omaralbeik.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/omaralbeik/SketchGen/master/Assets/logo.svg?sanitize=true\" title=\"SketchGen\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eSketchGen is a command line tool written in Swift that generates source code from sketch files.\u003c/p\u003e\n\n## Features\n\n- ✅ Extract assets from a Sketch file including:\n  - ➡️ colors (RGBA and HEX)\n  - ➡️ shadows\n  - ➡️ fonts\n  - ➡️ borders\n  - ➡️ radius values\n- ✅ Multi-page Sketch file parsing\n- ✅ Extract assets into a simple JSON file for easier interaction with other 3rd party tools\n- ✅ Generate Readable, `snake_cased`, and `camelCased`, `UPPERCASED`, `lowercased`, and `Capitalized` names\n- ✅ Use a templating system to generate source code for any programming language using your preferred style\n- ✅ Generate from anywhere including Linux and on CI\n\n## tl;dr\n\nSketchGen + [Example/styles.sketch](https://github.com/omaralbeik/SketchGen/blob/master/Example/styles.sketch) + [Example/templates](https://github.com/omaralbeik/SketchGen/tree/master/Example/templates) = [Example/generated](https://github.com/omaralbeik/SketchGen/tree/master/Example/generated)\n\n\u003e After [installation](#installation)\n\n```sh\ngit clone git@github.com:omaralbeik/SketchGen.git\ncd SketchGen\n\nsketchgen generate -s Example/styles.sketch ~/Desktop/Output Example/templates -v\n\nopen ~/Desktop/Output\n```\n\n\u003e Check generated source code in `Desktop/Output`\n\n## Installation\n\n### Homebrew (recommended)\n\n```sh\nbrew tap omaralbeik/formulae\nbrew install sketchgen\n```\n\n### [Mint](https://github.com/yonaskolb/Mint)\n\n```sh\nmint install omaralbeik/SketchGen\n```\n\n### Make\n\n```sh\ngit clone https://github.com/omaralbeik/SketchGen.git\ncd SketchGen\nmake install\n```\n\n### Swift Package Manager\n\n#### Use as CLI\n\n```sh\ngit clone https://github.com/omaralbeik/SketchGen.git\ncd SketchGen\nswift run sketchgen\n```\n\n#### Use as dependency\n\nAdd the following to your Package.swift file's dependencies:\n\n```swift\n.package(url: \"https://github.com/omaralbeik/SketchGen.git\", from: \"0.1.0\"),\n```\n\nAnd then import wherever needed: import SketchGen\n\n## Usage\n\n### Parse a Sketch file\n\n```sh\nsketchkit parse \u003c.sketch file path\u003e \u003cdestination path\u003e\n\n# Example:\n## Parse a a file named styles.sketch in Desktop and create a context.json in Desktop\nsketchkit parse ~/Desktop/styles.sketch ~/Desktop\n```\n\n### Generate source code\n\n#### From .sketch file\n\n```sh\nsketchkit generate -s \u003c.sketch file path\u003e \u003cdestination path\u003e \u003ctemplates folder path\u003e\n\n# Example:\n## Parse a file named styles.sketch in Desktop and create source code\n## in Desktop/generated, using templates in /Desktop/templates folder:\nsketchkit generate -s ~/Desktop/styles.sketch ~/Desktop/generated ~/Desktop/templates\n```\n\n#### From pre-generated context.json file\n\n```sh\nsketchkit generate -c \u003ccontext.json file path\u003e \u003cdestination path\u003e \u003ctemplates folder path\u003e\n\n# Example:\n## Parse a context file named context.json in Desktop and create source code\n## in Desktop/generated, using templates in /Desktop/templates folder:\nsketchkit generate -c ~/Desktop/context.json ~/Desktop/generated ~/Desktop/templates\n```\n\n### Flags\n\n|          |                 |                            |\n|:---------|:----------------|:---------------------------|\n| **`-v`** | **`--verbose`** | Log tech details for nerds |\n| **`-h`** | **`--help`**    | Show help information      |\n\n## A word about conventions in your Sketch file\n\nSketchGen expect the followingin your Sketch file:\n\n- Sketch file with **1 or more** pages\n- Each page should have **1 or more** artboards\n- Each artboard should have **exactly 1** rectangle or text layer\n- layer names **can have only english letters, numbers and _** and follow the following conventions:\n\n| Layer Type   | Prefix            | Examples of Valid Names                      |\n|:-------------|:------------------|:---------------------------------------------|\n| **`Color`**  | **`gen_color_`**  | `gen_color_primary`, `gen_color_dark_blue`   |\n| **`Shadow`** | **`gen_shadow_`** | `gen_shadow_small`, `gen_shadow_extra_large` |\n| **`Font`**   | **`gen_font_`**   | `gen_font_body`, `gen_font_heading_1`        |\n| **`Border`** | **`gen_border_`** | `gen_border_small`, `gen_border_extra_large` |\n| **`Radius`** | **`gen_radius_`** | `gen_radius_small`, `gen_radius_extra_large` |\n\n\u003e See [Example/styles.sketch](https://github.com/omaralbeik/SketchGen/blob/master/Example/styles.sketch) for an example.\n\n### Source code templates\n\nTemplates are written in [Stencil templating language](https://github.com/stencilproject/Stencil).\n\nOn top of Stencil's [built-in filters](http://stencil.fuller.li/en/latest/builtins.html#built-in-filters), `snakecased` and `camelcased` filters are added for more flexible source code generation.\n\n\u003e See [Example/templates](https://github.com/omaralbeik/SketchGen/tree/master/Example/templates) for examples for Swift, ObjC, CSS, and XML templates.\n\n## Attributions\n\n### This tool is powered by\n\n- [SwiftCLI](https://github.com/jakeheis/SwiftCLI)\n- [Stencil](https://github.com/stencilproject/Stencil)\n- [PathKit](https://github.com/kylef/PathKit)\n- [Sketch File Format](https://github.com/sketch-hq/sketch-file-format)\n- Icons in the logo are made by [freepik](https://www.flaticon.com/authors/freepik) from [flaticon.com](https://www.flaticon.com).\n\n### Thanks\n\n- [Mattt](https://twitter.com/mattt) for his great post [Swift Program Distribution with Homebrew](https://nshipster.com/homebrew/)\n- [Yonas Kolb](https://github.com/yonaskolb) for his very organized README and scripts in [XcodeGen](https://github.com/yonaskolb/XcodeGen) that I ended up copying most of it 😅\n\n## License\n\nSketchGen is released under the MIT license. See [LICENSE](https://github.com/omaralbeik/SketchGen/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomaralbeik%2Fsketchgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomaralbeik%2Fsketchgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomaralbeik%2Fsketchgen/lists"}