Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dsabre/generate-vue-cli

A Vue CLI to generate components instantly
https://github.com/dsabre/generate-vue-cli

Last synced: about 1 month ago
JSON representation

A Vue CLI to generate components instantly

Awesome Lists containing this project

README

        

# generate-vue-cli

A Vue CLI to generate components instantly.

## Run using npx

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

## Usage

```bash
# 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:

```bash
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):

```vue
// templates/GenericComponent.vue

const msg = '[[COMPONENT_NAME]] component';

{{ msg }}

```

then run:

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

## Authors

- [@dsabre](https://github.com/dsabre)

## License

[MIT](https://choosealicense.com/licenses/mit/)