How to automatically update your Sketch Libraries using RSS

Alasdair Monk
2 min readJul 11, 2018

--

In the changelog notes of Sketch 51, Bohemian Coding quietly announced that Sketch now supports “a URL protocol for adding Sketch Libraries backed by RSS feeds to Sketch”.

At Salesforce, we were eager to make use of this feature as we’ve recently been using our internal design platform Xray to host and distribute Sketch Libraries across the design organisation. Unfortunately it quickly became apparent there wasn’t a whole lot of documentation around this great new feature and so I’ve decided to write up the notes from our implementation here.

There’s only three things you need to automatically sync a self-hosted Sketch Library seamlessly with Sketch:

  • An XML file to act as the feed that Sketch will check for updates
  • Somewhere to host your Sketch Library
  • A link that opens Sketch and automatically downloads your library

The XML file

Create a file with the extension .xml using your favourite text editor. Start by using the template below:

Let’s break down the tags quickly:

  • <title> — This is the name you want to display in Sketch for your library
  • <image><url>… —The default thumbnail URL that Sketch will attempt to use for your library. It should point to a publicly accessibly image URL
  • <item>… — The information between the item tags is what you’ll want to update when you create new versions of your library. You only need one item tag within your feed. Within the item tag, we have…
  • <pubDate>… — Date the library was published, must in the RFC822 format
  • <enclosure>… — The enclosure tag has three attributes that are critical for your feed to work: url, type & sparkle:version. url should point directly to your .sketch file, type should be “application/octet-stream” and finally sparkle:version is a number that should increment every time you release a new update

A note about security: you can’t mix security types, for example hosting the XML feed on an https URL but then linking to an http: URL within the <enclosure> tag. This will result in an App Transport Security error within Sketch.

Update your file to reflect your own values and host it on the internet somewhere — for this example, let’s assume its hosted at

https://myexample.com/design/ui-kit.xml

Before we can make a URL to add our feed to Sketch, we first need to encode it. I used the Meyerweb URL encoder to give me an encoded URL. Our encoded URL looks like this;

https%3A%2F%2Fmyexample.com%2Fdesign%2Fui-kit.xml

Once you have your encoded URL, we just append it to Sketch’s special URL for adding Libraries, like so:

sketch://add-library?url=https%3A%2F%2Fmyexample.com%2Fdesign%2Fui-kit.xml

Congratulations! You can now push Sketch Library updates to everyone who added your library using the link above.

--

--