#!/bin/sh -e
# you need gs-common, pstoedit and skencil to
# get this script working
BASENAME=$(basename "$1"; echo x) BASENAME=${BASENAME%x}

# Outline fonts
eps2eps -dNOCACHE "$1" "${BASENAME}".ps2svg.ps

# Fix bounding box
ps2epsi "${BASENAME}".ps2svg.ps "${BASENAME}".ps
rm "${BASENAME}".ps2svg.ps

# Convert to Sketch
pstoedit -f sk "${BASENAME}".ps "${BASENAME}".sk

# Convert to SVG
skconvert "${BASENAME}".sk "${BASENAME}".svg
# You can also make the whole thing a big long pipe and eliminate the use of tmp files.