Installation
CLI
Learn how to use the Monicon CLI to generate icons
The Monicon CLI provides a command-line interface for generating icons, this is useful if you want to use Monicon as a tool-agnostic.
Installation
Install the Monicon Core globally
npm install @monicon/cli -gConfiguration
Create a monicon.config.ts (or .js) file in your project root:
import { , } from "@monicon/core/plugins";
import { } from "@monicon/core";
export default {
// Loads individual icons by icon name
: ["mdi:home", "feather:activity"],
// Loads all icons from a collection
: ["lucide"],
: [
({ : ["src/components/icons"] }),
({ : "src/components/icons" }),
],
} satisfies ;Commands
Generate Icons
Generate icons based on your configuration:
npx @monicon/cli generateThis command will:
- Load your
monicon.config.tsfile - Fetch the specified icons
- Generate components in the configured output path
Watch Mode
Run the CLI in watch mode to automatically regenerate icons when your config changes:
npx @monicon/cli generate -wThis is useful during development to see changes immediately.
Help
Display help information:
npx @monicon/cli -hVersion
Check the installed CLI version:
npx @monicon/cli -vUsage in Scripts
You can add the CLI to your package.json scripts for easy access:
{
"scripts": {
"dev": "npx @monicon/cli generate --watch && next dev",
"build": "npx @monicon/cli generate && next build"
}
}