https://github.com/mathieudutour/graphql-x-sketch
Querying a Sketch file with the flexibility of GraphQL
https://github.com/mathieudutour/graphql-x-sketch
graphql sketch
Last synced: about 1 month ago
JSON representation
Querying a Sketch file with the flexibility of GraphQL
- Host: GitHub
- URL: https://github.com/mathieudutour/graphql-x-sketch
- Owner: mathieudutour
- Created: 2018-03-24T10:14:08.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T19:14:47.000Z (about 2 years ago)
- Last Synced: 2025-02-28T19:20:11.248Z (2 months ago)
- Topics: graphql, sketch
- Language: JavaScript
- Homepage:
- Size: 526 KB
- Stars: 25
- Watchers: 5
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GraphQL x Sketch
Querying a [Sketch](https://sketchapp.com) file with the flexibility of [GraphQL](http://graphql.org)

## Installation
```bash
npm install -g graphql-x-sketch
```## Usage
### Server
```bash
graphql-x-sketch path/to/your/sketch/file
```You can either point to a sketch file directly or to a folder that contains multiple Sketch files. You can also pass multiple paths.
This will spawn a local GraphQL server (and a GraphiQL instance so that you can play with it).
The server will also serve the bitmaps bundled in the Sketch files. The `image` field of a `BitmapLayer` will be the URL to the image for example.
The server will also watch the paths for new/updates Sketch files.
### Single query
You can also directly run a GraphQL query without spwaning a server:
```
graphql-x-sketch path/to/your/sketch/file --run="my-graphql-query" --variables="{\"myVariable\": 3}"
```That could serve as an alternative to [`sketchtool`](https://developer.sketchapp.com/guides/sketchtool/) for example (and runs on any platform since it doesn't have any dependency to Sketch)
## Contributing
The graphQL schemas are in [`/lib/schema`](./lib/schema)