sprix
Version:
Sprites for your project, with pleasure
102 lines (69 loc) ⢠2.17 kB
Markdown
Sprites for your project, with pleasure!
Sprix is the most efficient, yet joyful way to work with icons in your project.
[]
- **CLI command for Sprite Generation**: Convert icon directories into an optimized SVG sprite sheet.
- **Fully Type-Safe**: Full TypeScript support with auto-generated types.
- **Premium Developer Experience**: Powerful VSCode integration for icon preview and navigation.
- **Flexible Structure**: Works with both flat and nested icon directories.
- **Tree Shaking**: Only the sprites you use are included.
- **Framework Agnostic**: Ready-to-use components for React, Svelte, Solid, Vue, or easily create your own.
```bash
npx sprix init --iconsPath ./icons
```
```bash
npm run sprix:generate
```
```
your-project/
āāā icons/
ā āāā arrow-right.svg
ā āāā ...
āāā sprix/
ā āāā sprites.svg
ā āāā sprites.ts
āāā sprix.config.json
```
```tsx
import { injectSprites } from "sprix";
injectSprites();
```
```tsx
import { Sprite } from "sprix/react";
function App() {
return <Sprite name="arrow-right" className="w-6 h-6" />;
}
```
[]
The init command will create a `sprix.config.json` file in your project root. This file is used to be used by the CLI and the VSCode extension. And it can also serve as a documentation for your sprites.
Multiple icons directories can be used targetting different directories.
```json
{
"sprites": [
{
"name": "icons",
"path": "./icons"
}
]
}
```
- `sprix init` - Initialize configuration
- `sprix build` - Generate sprite sheet
- `sprix watch` - Watch for changes
- `sprix check` - Validate icons
[]
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
MIT