diff --git a/Zeplin.sketchplugin/Contents/Sketch/export.cocoascript b/Zeplin.sketchplugin/Contents/Sketch/export.cocoascript index 6cdfe29..df2d4ed 100644 --- a/Zeplin.sketchplugin/Contents/Sketch/export.cocoascript +++ b/Zeplin.sketchplugin/Contents/Sketch/export.cocoascript @@ -90,6 +90,12 @@ var exportArtboardsFromCurrentPage = function (context) { var artboards = layersOfPagesWithClassName(NSArray.arrayWithObject(context.document.currentPage()), "MSArtboardGroup"); + if (![artboards count]) { + [NSApp displayDialog:@"Please create an artboard to export to Zeplin." withTitle:@"No artboard found"]; + + return; + } + exportArtboards(context, artboards); } @@ -100,6 +106,12 @@ var exportArtboardsFromAllPages = function (context) { var artboards = layersOfPagesWithClassName(context.document.pages(), "MSArtboardGroup"); + if (![artboards count]) { + [NSApp displayDialog:@"Please create an artboard to export to Zeplin." withTitle:@"No artboard found"]; + + return; + } + exportArtboards(context, artboards); } @@ -110,6 +122,12 @@ var exportSymbolsFromCurrentPage = function (context) { var artboards = layersOfPagesWithClassName(NSArray.arrayWithObject(context.document.currentPage()), "MSSymbolMaster"); + if (![artboards count]) { + [NSApp displayDialog:@"Please create a symbol to export to Zeplin." withTitle:@"No symbol found"]; + + return; + } + exportArtboards(context, artboards); } @@ -120,5 +138,11 @@ var exportSymbolsFromAllPages = function (context) { var artboards = layersOfPagesWithClassName(context.document.pages(), "MSSymbolMaster"); + if (![artboards count]) { + [NSApp displayDialog:@"Please create a symbol to export to Zeplin." withTitle:@"No symbol found"]; + + return; + } + exportArtboards(context, artboards); }