Standard Toolkit
Tooling@accelint/smeegle

Overview

CLI tool to create spritesheets and React Components from SVG files

Installation

Prerequisites

The spreet utility is required. Install via:

# Homebrew
brew install flother/taps/spreet

# Cargo
cargo install spreet

For other installation methods, see the official instructions.

Install smeegl

# Global installation
npm install -g @accelint/smeegl

# Local installation
pnpm install @accelint/smeegl

Usage

# Generate spritesheet from directory
smeegl --in ~/icons --out ~/atlas --target SPRITESHEET

# Generate React components from directory
smeegl --in ~/icons --out ~/components --target REACT

# Use glob pattern (no ~/ support)
smeegl --glob "/Users/me/icons/**/*.svg" --out ~/atlas --target SPRITESHEET

CLI Options

OptionDescriptionChoicesDefault
--targetOutput typeSPRITESHEET, REACTSPRITESHEET
--inInput directory path
--outOutput directory path./atlas
--globSVG glob pattern
--crcConvert sprite names to CRC32DEC, HEX
--spreetPath to spreet binaryspreet

Output Formats

Spritesheet Output

Generates three files:

1. atlas.png - Sprite atlas texture

2. atlas.json - Sprite index with coordinates

{
  "arrow": {"height": 48, "pixelRatio": 2, "width": 48, "x": 0, "y": 0},
  "arrow-down": {"height": 48, "pixelRatio": 2, "width": 48, "x": 0, "y": 48}
}

3. atlas.ts - TypeScript constants

export const ARROW = 'arrow'
export const ARROW_DOWN = 'arrow-down'

React Component Output

Generates a folder of React SVG components with TypeScript types:

// arrow.tsx
export const SvgArrow = ({
  title,
  titleId,
  ...props
}: SVGProps<SVGSVGElement> & Props) => {
  const { fill } = props;
  const fillColor = fill ?? '#FF69B4'
  const hasTitle = typeof title === 'string' && Boolean(title.trim());

  return (
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
      {hasTitle && <title id={titleId}>{title}</title>}
      <path d="..." fill={fillColor} />
    </svg>
  )
};
// index.ts
export { SvgArrow } from './arrow';
export { SvgArrowDown } from './arrow-down';

File Naming Rules

Character Normalization

  • Constants file: CONSTANT_CASE (e.g., ARROW_DOWN)
  • Index file: snake_case (e.g., arrow_down)
  • Directory separators and spaces → single underscore _
  • Parentheses are removed

Directory Structure Handling

Flat directory (no subfolders):

icons/
├── a.svg
└── b.svg
export const A = 'a'
export const B = 'b'

Nested directories:

icons/
├── group1/
│   ├── a.svg
│   └── b.svg
└── group2/
    ├── c.svg
    └── d.svg
export const GROUP1_A = 'group1_a'
export const GROUP1_B = 'group1_b'
export const GROUP2_C = 'group2_c'
export const GROUP2_D = 'group2_d'

Programmatic Usage

The core functions are also available as a library for programmatic usage. See the individual API pages for details:

SVG Requirements

For React component generation:

  • Icons should use a single fill color
  • Fill colors (except none) are replaced with component prop
  • Default fill: #FF69B4 (can be overridden)
  • SVG attributes are converted from kebab-case to camelCase
  • <title> element added for accessibility

Examples

Example 1: Generate Deck.gl Spritesheet

smeegl \
  --in ~/design-system/icons \
  --out ~/app/public/sprites/ui \
  --target SPRITESHEET

Example 2: Generate React Icon Library

smeegl \
  --in ~/figma-exports/icons \
  --out ~/app/src/components/icons \
  --target REACT

Example 3: Use Glob with CRC Names

smeegl \
  --glob "/Users/me/assets/**/*.svg" \
  --out ~/sprites/hashed \
  --target SPRITESHEET \
  --crc HEX

Example 4: Custom Spreet Binary

smeegl \
  --in ~/icons \
  --out ~/atlas \
  --spreet ./bin/spreet-custom

On this page