sprites

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 8 Imported by: 0

README ΒΆ

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

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL