Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Update _iconconvert script.
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Reiter <me@reitermark.us>
  • Loading branch information
reitermarkus committed Oct 12, 2017
1 parent 14ca109 commit 8b59935
Showing 1 changed file with 10 additions and 30 deletions.
@@ -1,40 +1,20 @@
#!/bin/sh
#!/usr/bin/env bash

for file in "${1}"*.svg; do
set -e

for file in "${1}"*.svg; do
if [[ "${file}" != 'none'* ]]; then
png="${file%.svg}.png"

png=`echo "${file}" | sed s/.svg/.png/`
# Clean up SVG file.
svgcleaner --indent=2 "${file}" "${file}"

# format SVG file
if type xmllint &>/dev/null; then
xmllint "${file}" -o "${file}" --pretty 1
else
echo "error: xmllint not installed" 2>1
exit 1
fi

# convert SVG file to PNG
# Convert SVG file to PNG.
if [ ! -f "${png}" ]; then

if type rsvg-convert &>/dev/null; then

# dependency: librsvg
echo "rsvg-convert: converting ${file}"
rsvg-convert "${file}" -o "${png}"

elif type svgexport &>/dev/null; then

# dependency: svgexport (via npm)
echo "svgexport: converting ${file}"
svgexport "${file}" "${png}"

else
echo "error: no SVG converter installed" 2>1
exit 1
fi

rsvg-convert "${file}" -o "${png}"
fi

# Losslessly minify PNG file.
pngout "${png}" -kbKGD
fi
done

0 comments on commit 8b59935

Please sign in to comment.