spritesh 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sprite.sh +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f98b280ae01a8a44b2288b1504668ec33f4eea21
|
4
|
+
data.tar.gz: 61443256bb814e5641b4e12c7ddf700df536d1ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0eb9b72ee4510729652e5e24793fc7e9c3b8593cc64215aaff00784ecebc4fbc2d475fa5f6fe3423638fa15d010226910a936537c60177971716ad90edd3099
|
7
|
+
data.tar.gz: 8c4321ffc7b5aa46e9c66b3a78c684d46bb93f6baf86fdb5675686d83339c6b09b13046212e58941725ad8fd761f747fd7787d093ef18507e520e761aff55d43
|
data/bin/sprite.sh
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
PROGNAME
|
4
|
-
SRC_FOLDER
|
5
|
-
DEST_FILE=sprite.svg
|
3
|
+
PROGNAME="${0##*/}"
|
4
|
+
SRC_FOLDER="."
|
5
|
+
DEST_FILE="sprite.svg"
|
6
6
|
ID_PREFIX=""
|
7
7
|
QUIET="0"
|
8
8
|
|
@@ -25,38 +25,38 @@ EO
|
|
25
25
|
|
26
26
|
echo_verbose ()
|
27
27
|
{
|
28
|
-
if [ $QUIET == "0" ]; then
|
29
|
-
echo $1
|
28
|
+
if [ "$QUIET" == "0" ]; then
|
29
|
+
echo "$1"
|
30
30
|
fi
|
31
31
|
}
|
32
32
|
|
33
33
|
clean ()
|
34
34
|
{
|
35
|
-
rm -rf $DEST_FILE
|
35
|
+
rm -rf "$DEST_FILE"
|
36
36
|
}
|
37
37
|
|
38
38
|
main ()
|
39
39
|
{
|
40
|
-
for f in $SRC_FOLDER/*.svg; do
|
41
|
-
if [ -f $f ]; then
|
42
|
-
NAME
|
43
|
-
VIEWBOX
|
40
|
+
for f in "$SRC_FOLDER"/*.svg; do
|
41
|
+
if [ -f "$f" ]; then
|
42
|
+
NAME="$(basename "$f" .svg)"
|
43
|
+
VIEWBOX="${VIEWBOX_SIZE:-$(sed -n -E 's/.*viewBox="([^"]+)".*/\1/p' "$f")}"
|
44
|
+
ID="$(echo "$ID_PREFIX$NAME" | tr ' ' '-')"
|
44
45
|
|
45
46
|
echo_verbose "Processing \`$f\` (viewBox \`$VIEWBOX\`)…"
|
46
|
-
echo "<symbol id='$
|
47
|
+
echo "<symbol id='$ID' viewBox='$VIEWBOX'>$(cat "$f")</symbol>" >> "$DEST_FILE"
|
47
48
|
fi
|
48
49
|
done
|
49
50
|
|
50
|
-
if [ -f $
|
51
|
-
awk 'BEGIN{print "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" style=\"display:none\">"}{print}END{print "</svg>"}' $DEST_FILE > .spritesh && mv .spritesh $DEST_FILE
|
51
|
+
if [ -f "$DEST_FILE" ]; then
|
52
|
+
awk 'BEGIN{print "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" style=\"display:none\">"}{print}END{print "</svg>"}' "$DEST_FILE" > .spritesh && mv .spritesh "$DEST_FILE"
|
52
53
|
fi
|
53
|
-
|
54
54
|
}
|
55
55
|
|
56
56
|
# Grabbing options
|
57
57
|
while [[ $# > 0 ]]; do
|
58
58
|
key="$1"
|
59
|
-
case $key in
|
59
|
+
case "$key" in
|
60
60
|
-h|--help)
|
61
61
|
usage
|
62
62
|
exit 0
|
@@ -89,7 +89,7 @@ done
|
|
89
89
|
clean
|
90
90
|
main
|
91
91
|
|
92
|
-
if [ -f $DEST_FILE ]; then
|
92
|
+
if [ -f "$DEST_FILE" ]; then
|
93
93
|
echo_verbose "File \`$DEST_FILE\` successfully generated."
|
94
94
|
else
|
95
95
|
echo_verbose "Could not generated \`$DEST_FILE\`. Are there any SVG file in \`$SRC_FOLDER\` folder?"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spritesh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hugo Giraudel
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Bash script to build a SVG sprite from a folder of SVG files (typically
|
15
15
|
icons).
|