Generally trying to create an svg sprite using the npm svg-sprite package. As a result, I get something like this sprite (for 2 pictures):
... <svg viewBox="0 0 108 54" ...> <svg height="54" width="54" viewBox="-2 -2 54 54" ...> <path d="...”> </svg> <svg height="54" width="54" viewBox="-2 -2 54 54" ...> <path d="...”> </svg> </svg> To determine the size of the output sprite in CLI, I use the identify command from the ImageMagick utility. For example, so
identify -format '%w' icons-test.svg
or immediately write to the file
echo "\$spriteWidth = $(identify -format '%w' icons-test.svg)px" >> styles.styl
The problem is that as a result, the width of the entire sprite (108) is not recorded in the file, but only the last image included in it (54).
Tell me what I'm doing wrong, how to fix it? Or advise an alternative way to solve the problem.