Skip to content

dsabre/generate-vue-cli

Repository files navigation

generate-vue-cli

A Vue CLI to generate components instantly.

Run using npx

npx @dsabre/generate-vue-cli --dir=src/components --name=HelloWorld

Usage

# Usage: npx @dsabre/generate-vue-cli [flags]

# Generate a Vue component.

# Flags:
#   --dir        (required)   The directory where the component will be generated.
#   --name       (required)   The name of the component.
#   --prefix     (optional)   Prefix to prepend to component name.
#   --suffix     (optional)   Suffix to append to component name.
#   --template   (optional)   The template path to use.
#
#   -h, --help   Display this help message and exit.

# Example:
#   npx @dsabre/generate-vue-cli --dir="src/components" --name="HelloWorld" --prefix="Prefix" --suffix="Suffix"`);

Examples

Create a src/components/HelloWorld.vue component:

npx @dsabre/generate-vue-cli --dir=src/components --name=HelloWorld

Using templates

You can specify a custom template of your own (use [[COMPONENT_NAME]] token to print the new component name, it will be replaced when the component is created):

// templates/GenericComponent.vue

<script setup>
const msg = '[[COMPONENT_NAME]] component';
</script>

<template>
    <div>{{ msg }}</div>
</template>

then run:

npx @dsabre/generate-vue-cli --dir=src/components --name=HelloWorld --template=templates/GenericComponent.vue

Authors

License

MIT

About

A Vue CLI to generate components instantly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published