Sprites π§
A CLI tool that generates SVG spritesheets from a directory of SVG files.
β οΈ Please don't use this package, this is a personal experimental project.
Installation
npm install @brattonross/sprites
Usage
Given the following directory structure:
public
βββ svg
βββ icons
βββ 20
β βββ solid
β βββ arrow-left-on-rectangle.svg
β βββ pencil-square.svg
β βββ user.svg
βββ 24
βββ outline
βββ computer-desktop.svg
βββ moon.svg
βββ sun.svg
Running the following command:
sprites --src public/svg/icons --sprites public/svg/spritesheets --components src/components/icons
Will generate the following structure:
public
βββ svg
βββ icons
β βββ 20
β β βββ solid
β β βββ arrow-left-on-rectangle.svg
β β βββ pencil-square.svg
β β βββ user.svg
β βββ 24
β βββ outline
β βββ computer-desktop.svg
β βββ moon.svg
β βββ sun.svg
βββ spritesheets
βββ 20-solid.svg
βββ 24-outline.svg
src
βββ components
βββ icons
βββ 20-solid.tsx
βββ 24-outline.tsx
It is assumed that you will be serving the generated spritesheets from the public
directory.
Prior Art