Transform SVGs into Framework Components
A powerful, zero-dependency command-line tool that instantly converts SVG files into clean, optimized components for any modern JavaScript framework. First-class support for React, Vue, Angular, Svelte, and 5+ more frameworks.
Why SVGer CLI?
Zero Dependencies
No node_modules bloat. Drastically smaller footprint with no third-party vulnerabilities.
52% Faster
Native performance with parallel processing and smart caching system. Real-world tested on 606 production SVG icons.
9+ Frameworks
React, Vue, Angular, Svelte, Solid, Lit, Preact, React Native & Vanilla JS.
Auto Exports
Automatically generates clean index.ts files with tree-shaking support.
Installation
Install globally for CLI access:
npm install -g svger-cli
Or add to your project:
npm install --save-dev svger-cli
Quick Start
1. Convert a single SVG file:
svger-cli convert ./icons/logo.svg --framework react --output ./components
2. Batch convert an entire directory:
svger-cli batch ./icons --framework vue --output ./components/icons
3. Use the generated component:
import { Logo } from './components';
function App() {
return <Logo className="w-8 h-8" />;
}
Build Tool Integrations
First-class support for all major build tools with zero configuration.
Webpack
const { SvgerWebpackPlugin } = require('svger-cli/webpack');
module.exports = {
plugins: [new SvgerWebpackPlugin()],
};
Vite
import { svgerVitePlugin } from 'svger-cli/vite';
export default {
plugins: [svgerVitePlugin()],
};
Next.js
const { withSvger } = require('svger-cli/nextjs');
module.exports = withSvger({});
Feature Comparison
| Feature | SVGer CLI v4.0.0 | SVGR | Others |
|---|---|---|---|
| Dependencies |
Zero
|
15+ | 7-9+ |
| Framework Support |
9+
|
React only | Single |
| Performance |
52% Faster
|
Standard | Standard |
| Bundle Size |
~2MB
|
~18.7MB | ~11-14MB |
| Auto Migration | |||
| React Native | |||
| Auto Exports |
Multi-Framework Support
SVGer CLI supports 9+ modern frameworks with consistent API and output quality.
React
Vue 3
Angular
Svelte
Solid
Lit
Preact
React Native
Vanilla JS
Real-World Performance
Tested on 606 production SVG icons (1.01MB) - real benchmarks, not synthetic tests.
Processing Speed
52%
Faster than SVGR
Bundle Size
~2MB
90% smaller package
Memory Usage
0.17MB
69% less than SVGR
Live Performance Testing
Test SVG processing performance directly in your browser. Upload SVG files or use sample data to see real-time conversion metrics.
Benchmark Configuration
Test Results
Running...Files Processed
0
Total Time
0ms
Avg Per File
0ms
Throughput
0/s
Detailed Output
Configuration
Create a .svgerconfig.json file in your project root for persistent settings.
{
"framework": "react",
"typescript": true,
"outputDir": "./components/icons",
"exportIndex": true,
"svgo": true,
"prettier": true,
"naming": "pascal",
"extension": "tsx"
}
Configuration Options
framework
Target framework: react, vue, angular, svelte, solid, lit, preact, or vanilla
typescript
Generate TypeScript files (.tsx/.ts) instead of JavaScript (.jsx/.js)
outputDir
Directory where generated components will be saved
exportIndex
Generate an index file that exports all components
naming
Component naming convention: pascal, camel, or kebab
svgo
Enable SVG optimization (reduces file size by 30-50%)
prettier
Format generated code with Prettier (requires Prettier installed)
CLI Reference
Complete command-line interface reference for all available options.
Basic Commands
# Convert SVGs to components
svger-cli --src ./icons --out ./components
# With framework and TypeScript
svger-cli --src ./icons --out ./components --framework react --typescript
# Watch mode (auto-rebuild on file changes)
svger-cli --src ./icons --out ./components --watch
# With plugins
svger-cli --src ./icons --out ./components --plugins optimize,minify
# List available plugins
svger-cli --list-plugins
# Show version
svger-cli --version
# Show help
svger-cli --help
Available Options
| Option | Description | Default |
|---|---|---|
--src, -s |
Source directory containing SVG files | Required |
--out, -o |
Output directory for components | Required |
--framework, -f |
Target framework | react |
--typescript, -t |
Generate TypeScript files | false |
--watch, -w |
Watch for file changes | false |
--plugins, -p |
Comma-separated list of plugins | None |
--naming |
Naming convention (pascal, camel, kebab) | pascal |
--export-index |
Generate index file | true |
--svgo |
Enable SVG optimization | true |
--prettier |
Format with Prettier | true |
--list-plugins |
List available plugins | - |
--version, -v |
Show version number | - |
--help, -h |
Show help message | - |
Plugin System
Extend SVGER-CLI with powerful plugins for optimization, theming, and custom transformations.
Built-in Plugins
optimize
Built-inAdvanced SVG optimization and cleaning. Removes unnecessary attributes, optimizes paths, and reduces file size by 30-50%.
svger-cli --src ./icons --out ./components --plugin optimize
color-theme
Built-inApply color themes and palette transformations. Replace colors, create theme variants, and ensure design consistency.
svger-cli --src ./icons --out ./components --plugin color-theme
minify
Built-inAggressive size reduction for production builds. Removes whitespace, comments, and applies maximum compression.
svger-cli --src ./icons --out ./components --plugin minify
Using Multiple Plugins
Plugins are executed in the order specified, allowing you to chain transformations:
# Apply optimization, then theming, then minification
svger-cli --src ./icons --out ./components --plugins optimize,color-theme,minify
Programmatic Plugin API
Use plugins programmatically in your Node.js scripts:
import { svgProcessor } from 'svger-cli';
const result = await svgProcessor.processWithPlugins(svgContent, {
plugins: ['optimize', 'minify'],
config: {
optimize: {
precision: 2,
removeUnusedDefs: true
},
minify: {
aggressive: true
}
}
});
Testing
Try SVGER-CLI before installing, or test with 500+ included sample SVGs.
š Method 1: Online Demo (No Installation)
Test instantly in your browser with our interactive demo:
- 10 pre-loaded sample SVGs
- Drag & drop file upload
- Switch between frameworks
- Real-time performance metrics
- Export results as JSON
š» Method 2: CLI Test Utility
Use the test-svger command with 500+ included sample SVGs:
# Install globally
npm install -g svger-cli
# Quick test with default settings
test-svger
# Test with specific framework
test-svger --framework=vue --typescript
# Test with limited files
test-svger --count=20
# Show help
test-svger --help
Sample SVG Categories
The package includes 500+ professional SVG files:
Brand Logos (200+)
Google, Facebook, GitHub, Twitter, LinkedIn, etc.
UI Icons (100+)
Home, User, Settings, Search, etc.
Tech Logos (100+)
React, Vue, Docker, AWS, etc.
Shapes & Symbols (50+)
Geometric shapes, arrows, patterns
Production Deployment
Best practices for deploying SVGER-CLI in production environments.
CI/CD Integration
Automate SVG processing in your CI/CD pipeline:
# GitHub Actions example
name: Build Icons
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install -g svger-cli
- run: svger-cli --src ./assets/icons --out ./src/components/icons --plugins optimize,minify
- run: npm run build
Docker Integration
Use SVGER-CLI in Docker containers:
FROM node:18-alpine
WORKDIR /app
RUN npm install -g svger-cli
COPY assets/icons ./icons
RUN svger-cli --src ./icons --out ./components --plugins optimize,minify
COPY . .
RUN npm install && npm run build
Troubleshooting & FAQ
Q: Components are not rendering correctly
Solution: Ensure your SVG files are valid and properly formatted. Try enabling the optimize plugin:
svger-cli --src ./icons --out ./components --plugin optimize
Q: Watch mode is not detecting file changes
Solution: Some systems have file watcher limits. Increase the limit:
# Linux/Mac
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Q: Generated components have TypeScript errors
Solution: Install required type definitions:
npm install --save-dev @types/react @types/react-dom
Q: How do I migrate from another SVG tool?
Solution: SVGER-CLI is designed to be a drop-in replacement. Simply point it at your SVG directory and configure your preferred framework. The generated components follow standard patterns and conventions.
Q: Can I use custom SVG optimization settings?
Solution: Yes! Create a .svgerconfig.json file with custom optimization settings:
{
"svgo": true,
"svgoConfig": {
"plugins": [
"removeViewBox",
"removeDimensions"
]
}
}