vue-generator icon indicating copy to clipboard operation
vue-generator copied to clipboard

Add {{filename}} variable in templates

Open mitchell-garcia opened this issue 8 years ago • 1 comments

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.

mitchell-garcia avatar Oct 06 '17 19:10 mitchell-garcia

@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.

pigeonfresh avatar Oct 11 '17 11:10 pigeonfresh