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 spreetFor other installation methods, see the official instructions.
Install smeegl
# Global installation
npm install -g @accelint/smeegl
# Local installation
pnpm install @accelint/smeeglUsage
# 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 SPRITESHEETCLI Options
| Option | Description | Choices | Default |
|---|---|---|---|
--target | Output type | SPRITESHEET, REACT | SPRITESHEET |
--in | Input directory path | ||
--out | Output directory path | ./atlas | |
--glob | SVG glob pattern | ||
--crc | Convert sprite names to CRC32 | DEC, HEX | |
--spreet | Path to spreet binary | spreet |
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.svgexport const A = 'a'
export const B = 'b'Nested directories:
icons/
├── group1/
│ ├── a.svg
│ └── b.svg
└── group2/
├── c.svg
└── d.svgexport 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:
- buildSpritesheet - Generate spritesheet files programmatically
- buildReactFiles - Generate React components programmatically
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-casetocamelCase <title>element added for accessibility
Examples
Example 1: Generate Deck.gl Spritesheet
smeegl \
--in ~/design-system/icons \
--out ~/app/public/sprites/ui \
--target SPRITESHEETExample 2: Generate React Icon Library
smeegl \
--in ~/figma-exports/icons \
--out ~/app/src/components/icons \
--target REACTExample 3: Use Glob with CRC Names
smeegl \
--glob "/Users/me/assets/**/*.svg" \
--out ~/sprites/hashed \
--target SPRITESHEET \
--crc HEXExample 4: Custom Spreet Binary
smeegl \
--in ~/icons \
--out ~/atlas \
--spreet ./bin/spreet-customRelated
- buildSpritesheet - Spritesheet generation core
- buildReactFiles - React component generation core
- smeegl - Programmatic API
- validateInput - Input validation utilities
- logMsg - Logging utilities