No default templates

Hi all,

Yesterday, I purchased Sketch and installed it on my Mac.
For some reason, there are no default templates. There is not even a button to add one.
Please see the screenshot below.

  • Sketch version: 99.5, a Mac-only license
  • macOS version: Sonoma 14.3.1

Am I missing something? How can I add the default templates?
I really appreciate your help!

Hello Igor :wave:,

Welcome to our community! It’s great to have you here. Thank you for reaching out to us with your inquiry. I’ve already responded to your message via the contact form, but I wanted to address it here as well for the benefit of others who might have similar questions.

I’m sorry to hear about your frustration with the current template options available for Mac-only licenses. We’re actively working on improving this experience for all users. In the meantime, one workaround is to curate your own collection of templates from various sources and save them as Sketch documents. Here’s a step-by-step guide to turn them into templates:

  1. Quit Sketch.
  2. Open Finder and click on the “Go” menu in the top menu bar.
  3. Select the “Go to Folder” option.
  4. Type the following path in the text field: ~/Library/Application Support/com.bohemiancoding.sketch3/
  5. Press the “Enter” button to open the location of all files related to the Sketch Mac app application.
  6. Look for a folder named “Template” in this location.
  7. Copy and paste the files you want to use as templates into the “Template” folder.

CleanShot 2024-02-19 at 09.39.17

We hope this helps. :pray:

Cheers!

2 Likes

One other option is to go to the Sketch Templates web page directly and browse templates there. In order to download a template, open it and choose “Download” in the context menu (you don’t need a Sketch Workspace subscription to do that):


P.S. There’s also a way to download all available template documents automatically via Sketch GraphQL API if you’re into that :nerd_face:

Here’s a totally-untested-just-thrown-together Ruby script that populates your local “Templates” folder mentioned above:

populate_sketch_templates.rb
#!/usr/bin/ruby

require 'net/http'
require 'open-uri'
require 'json'

$API = URI('https://graphql.sketch.cloud/api')
$SKETCH_TEMPLATES_WORKSPACE_ID = "0bf59947-7176-4258-8255-7b82b57b1f68" # The "Sketch Templates" workspace

def templates_query(cursor = nil)
	%{
		query {
			workspaceProfile(workspaceIdentifier: \"#{$SKETCH_TEMPLATES_WORKSPACE_ID}\") {
				publications(after: #{cursor ? "\"#{cursor}\"" : "null"}, limit: 50) {
					meta { after },
					entries {
						share {
							templateCategory, version { document { name, url } }
						}
					}
				}
			}
		}
	}
end


def all_templates(cursor = nil)
	results = []
	
	req = Net::HTTP::Post.new($API)
	req.add_field "Content-Type", "application/json"
	req.add_field "Accept", "application/json"
	req.body = JSON.dump({
		"query": templates_query(cursor)
	})
	
	Net::HTTP.start($API.host, $API.port, use_ssl: true) do |http|
		res = http.request req
		fail unless res.kind_of? Net::HTTPSuccess
		data = JSON.parse(res.body)
		fail if data["errors"]
		
		results += data.dig("data", "workspaceProfile", "publications", "entries").map { |e| e["share"] }
		next_cursor = data.dig "data", "workspaceProfile", "publications", "meta", "after"

		if next_cursor
			results += all_templates(next_cursor)
		end
	end
	
	return results
rescue StandardError => e
	puts "[!] HTTP Request failed (#{e.message})"
end

def download_file(url, detination_path)
	IO.copy_stream(URI.open(url), detination_path)
rescue StandardError => e
	puts "[!] File download failed (#{e.message})"
end

Dir.chdir(File.expand_path("~/Library/Application Support/com.bohemiancoding.sketch3/Templates/")) do
	puts "Downloading a list of available templates..."
	all_templates().each do |template|
		category = template["templateCategory"]
		name = template.dig("version", "document", "name") 
		url = template.dig("version", "document", "url")
		
		puts "Downloading #{name}..."
		filename = ("[#{category}] " + name + ".sketch").gsub "/", ":"
		download_file url, filename
	end
	puts "Done!"
end

Here’s the result:

2 Likes

Hi,

Thank you so much for your help, Cristiana and Dmitry, really appreciated!

P. S. Special thanks for the automation hint using GraphQL API :slight_smile:

2 Likes