VueTemplateOrganizer is a tool that allows you to configure the sorting of template blocks in Vue Single File Components (SFCs).
- Configurable Sorting: Customize the sorting of template blocks to fit your specific needs.
- Support for Vue SFCs: Use VueTemplateOrganizer with traditional Vue Single File Components.
- Global install: There is a known issue with path regarding global installation
Follow these steps to get started with VueTemplateOrganizer in your project.
npm install @derkatzelp/vuetemplateorganizer --save-devnpx tmp-organizerYou can customize the sorting behavior by adjusting the configuration in config.tmporg.json and sorting.tmporg.json.
VueTemplateOrganizer will sort all properties by this given order.
// config.tmporg.json
{
"showLogFiles": true,
"showLogFolders": false,
"sortVueFiles": true,
"vueFolderPath": "./src/"
}// sorting.tmporg.json
[
"v-if",
"v-else-if",
"v-else",
"v-show",
"v-for",
"v-model",
"v-bind",
"v-on",
"v-html",
"v-text",
"v-pre",
"v-once",
"v-cloak",
"id",
":id",
"class",
"style",
"type",
"name",
"value",
"href",
"src",
"alt",
"title",
"placeholder",
"autocomplete",
"required",
"disabled",
"readonly",
"checked",
"selected",
"multiple",
"pattern",
"min",
"max",
"step",
"rows",
"cols",
"for",
"action",
"method",
"target",
"rel",
"role",
"aria-*",
"data-*",
":*",
":is",
":class",
":customProp",
"@*",
"@click",
"@input",
"@change",
"@submit",
"slot",
"slot-scope",
"ref",
"key",
"transition",
"transition-group",
"is",
"inline-template",
"custom-*"
]
| Key | Values | Default | Description |
|---|---|---|---|
showLogFiles |
Boolean | true |
Enables or disables log report of touched Files |
showLogFolders |
Boolean | true |
Enables or disables log report of touched Folders |
sortVueFiles |
Boolean | true |
Enables or disables sorting of Vue SFC Files |
vueFolderPath |
String | ./src/ |
Specifies the path to Vue SFC Files (subfolders included) |
<template>
<h1>Test Vue File for Vue Template Organizer</h1>
<CustomComp class="class1" @click="testfnc" :id="comp1Id"/>
<CustomComp2 @click="testfnc"/>
<p class="par">Just a simple Test</p>
<label for="txtinput">Your input here</label>
<input type="text" class="input-c" id="txtinput" ref="myRef"/>
</template><template>
<h1>Test Vue File for Vue Template Organizer</h1>
<CustomComp :id="comp1Id" class="class1" @click="testfnc"></CustomComp>
<CustomComp2 @click="testfnc"></CustomComp2>
<p class="par">Just a simple Test</p>
<label for="txtinput">Your input here</label>
<input id="txtinput" class="input-c" type="text" ref="myRef"/>
</template>VueTemplateOrganizer relies on the following external libraries:
- dom-serializer - For DOM element serialization
- htmlparser2 - For parsing HTML/Vue templates
If you'd like to contribute to VueTemplateOrganizer, please contact me.
This project is licensed under the MIT License.
Special thanks to:
- The maintainers of dom-serializer and htmlparser2 for providing robust parsing tools
- The Vue.js community for inspiration and support