Querying a Sketch file with the flexibility of GraphQL
npm install -g graphql-x-sketch
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.
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
for example (and runs on any platform since it doesn't have any dependency to Sketch)
The graphQL schemas are in /lib/schema