Skip to content

Instantly share code, notes, and snippets.

View bomberstudios's full-sized avatar
🍊
Thinking

Ale Muñoz bomberstudios

🍊
Thinking
View GitHub Profile

We've identified an issue where a plugin with malformed or missing version info can result in a non-working Plugins menu. We'll release a fix for that as soon as humanly possible in Sketch 46.1. Meanwhile, you can try disabling plugins that don't have a version number using Sketch 45 (you can download it from https://sketchapp.com/updates/#version-45-2) and then launching Sketch 46.

Hope it helps!

@bomberstudios
bomberstudios / fix-principle.md
Created November 15, 2016 21:02
How to fix Principle 2.0.6

If you're using Principle 2.0.6, you're probably aware that its Sketch importer no longer works with Sketch 41. We've made some changes to the way our exporter works under the hood, and as a result they had to update a few lines of code on the plugin they run to import from Sketch.

Surprisingly, they've decided to make their fix available only for users of Principle 2.1 (a paid upgrade). If you'd rather not have to pay for a trivial fix, here's what you can do:

  • Download the trial for Principle 2.1 from https://principleformac.com
  • Right click the app bundle you just downloaded, choose "Show Package Contents", and navigate to Principle.app/Contents/Resources/
  • Select the script.js file and copy it (Cmd+C)
  • Now go to your Applications folder, right click Principle.app, choose "Show Package Contents" and navigate to Principle.app/Contents/Resources/
  • Paste script.js (Cmd+V)
  • Relaunch Principle 2.0.6

Sketch Image Compressor (Beta)

A Plugin for Sketch that compresses your bitmap assets, to keep filesize to a minimum.

Please note that the compression is lossless, so no pixels will be harmed by running this Plugin : )

Installation

  • Download Sketch Image Compressor & unzip it.
  • Double click Sketch Image Compressor.sketchplugin to install the Plugin.
var pages = context.document.pages()
for (var i = 0; i < pages.count(); i++) {
pages.objectAtIndex(i).isVisible = 1
}
@bomberstudios
bomberstudios / README.md
Last active February 16, 2022 03:13
Loading a Cocoa Framework in a Sketch Plugin

This is what Craft does:

function loadFramework(pluginRoot) {
  if (NSClassFromString('PanelsManager') == null) {
    var mocha = [Mocha sharedRuntime];
    return [mocha loadFrameworkWithName:'Panels' inDirectory:pluginRoot];
  } else {
    return true;
 }
@bomberstudios
bomberstudios / sketch-diff-in-git.md
Last active November 8, 2019 17:58
How to diff your .sketch files in Git

Using sketchtool to diff your .sketch files using text

Requirements

You need to have SketchTool installed somewhere in your path.

Setup

Add this in your ~/.gitconfig file (for some reason, it won't work in a local .gitconfig file):

// Disable all Blurs in document
var doc = context.document,
pages = doc.pages()
for (var i = 0; i < [pages count]; i++) {
var currentPage = [pages objectAtIndex:i]
var all_layers = [currentPage children]
for (var j = 0; j < [all_layers count]; j++) {
var current_layer = [all_layers objectAtIndex:j]
if(current_layer.style != undefined){
// Show All Layers in All Pages
var doc = context.document,
pages = doc.pages()
for (var i = 0; i < [pages count]; i++) {
var currentPage = [pages objectAtIndex:i]
var all_layers = [currentPage children]
for (var j = 0; j < [all_layers count]; j++) {
var current_layer = [all_layers objectAtIndex:j]
[current_layer setIsVisible:true]
function copy_text(txt){
var pasteBoard = [NSPasteboard generalPasteboard]
[pasteBoard declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil]
[pasteBoard setString:txt forType:NSPasteboardTypeString]
}
var s = context.selection[0]
var css = s.CSSAttributeString()
var framerCSS = css.replace("border-radius", "borderRadius")