vue-generator
vue-generator copied to clipboard
Add {{filename}} variable in templates
I use this library a lot, but have had issues with it including the directory structure into the class name. For example, if I want to make a component in a specific directory like this:
vg component Common/Typography/BigText
with this template:
<script lang="ts">
import Vue from 'vue';
import { Component } from 'vue-property-decorator';
@Component
export default class {{name_pc}} extends Vue {
}
Vue.component('{{name_pc}}', {{name_pc}});
</script>
<style module>
</style>
<template>
</template>
It will set the Vue component's name to CommonTypographyBigText, when I really just want BigText.
This PR exposes a {{filename}} variable in templates for use with Vue classes + Vue.component() function calls.
@mmitchellgarcia if you love vue-generator I would like to recommend @hjeti's seng-generator. It's more likely that updates will be made to this repo.