SketchTool

2018-06-19  本文已影响9人  CodingTom

什么是 SketchTool

SketchTool是一个与Sketch捆绑的 命令行实用工具 ,它允许您使用Sketch文档执行一些操作,比如检查或导出资源。它还允许您从命令行控制Sketch来执行一些操作。

安装SketchTool

下载Sketch,解压 Sketch 获取 Sketch.app;把 Sketch.app 拖到 Applications(应用程序)中。

Sketch下载地址

安装完 Sketch.app 你就可以在 Sketch.app/Contents/Resources/sketchtool/bin 目录下找到sketchtool

导出PNG Shell 命令

#!/bin/bash
export PATH=$PATH:/Applications/Sketch.app/Contents/Resources/sketchtool/bin
#echo $PATH
#sketchtool help

sketchtool export artboards inputFilePath --output=DirPath --formats="png"

在Xocode中导出

怎样从Sketch向Xcode自动导出图形资源

# AppIcon
export PATH=$PATH:/Applications/Sketch.app/Contents/Resources/sketchtool/bin

sketchtool export artboards "$PROJECT_DIR"/"Graphics Resources/AppIcon.sketch" --output="$PROJECT_DIR"/"$PROJECT_NAME"/Images.xcassets/AppIcon.appiconset --formats="png"

# LaunchImage
sketchtool export artboards "$PROJECT_DIR"/"Graphics Resources/LaunchImage.sketch" --output="$PROJECT_DIR"/"$PROJECT_NAME"/Images.xcassets/LaunchImage.launchimage --formats="png"

相关资源参考连接

sketchtool guides

Sketch官网

上一篇 下一篇

猜你喜欢

热点阅读