CLI util for easy generate Vue js component
Installation
npm install -g vue-generate-component
Usage
vgc --help
Create new component
vgc footer
Will generate five files:
footer.js
name: 'footer' props: {} { return {}; } methods: {} computed: {};
footer.spec.js
;; // Here are some Jasmine 2.0 tests, though you can// use any test runner / assertion library combo you prefer;
footer.html
footer Component
footer.scss
index.vue
Create new component single file
vgc -s home
will generate one vue file:
<template lang="html"> <section class="home"> <h1>home Component</h1> </section></template> <script lang="js"> name: 'home' props: { } { return } methods: computed: </script> <style scoped lang="scss"> home </style>
Create new component single file inside new folder
vgc -s home --folder
Create new directive
vgc -d my-directive
will generate:
my-directive.directive.js
; Vue;
If you want use postfix in file name, use -- postfix
vgc footer --postfix page
Will generate files with postfix:
- footer.page.js
- footer.page.css
- footer.page.html
- footer.page.spec.js
Change the default file types for html, style, script, and spec
sudo vgc --html jade --style less --script ts --spec ts
Contribute
If you want to fix/improve the templates you're welcome to create a PR.