Vue Component Generators
Component generators enable you to easily create new components. Generators include boilerplate code as well as configs, such as default env to be set for the component.
To add templates from your Vue dev environment to a workspace, add your env to the generator section in `workspace.jsonc`:
{ "teambit.generator/generator": { "envs": ["my-org.my-scope/envs/my-vue-env"] } }
Run the following to list the available component templates for vue:
You should see the following templates - note the output includes the env they are associated with:
vue-env
vue
vue-composable
vue-app
Use bit create
with any template to generate a new component:
You can also create your own component generators, and expose them via your custom env.
To create your own custom generators, we recommend starting by forking the default Vue generator component:
See the Create Component Generators section for more information on creating custom generators.
Once your generators are ready, ensure to import your custom templates and register them to your env:
// my-vue-env.bit-env.ts import { MyVueEnvGenerator } from '@my-org/my-scope.templates.my-vue-generators'; export class MyReactEnv extends ReactEnv { generators() { return TemplateList.from([ MyVueEnvGenerator.from(), ]); }
info
Make sure to run bit compile
after adding the new generators - you can run bit watch
to automatically compile on changes.