dprint-plugin-vue
Format Vue SFC.
This plugin only parses root-level blocks, extract their content, and format them through dprint
according to the lang
attribute or a default:
Block | Default |
---|---|
script |
js |
template |
html |
style |
css |
This means you also need to install plugins for languages contained in your Vue SFC, such as dprint-plugin-typescript
for JavaScript / TypeScript.
Usage
Install and setup dprint, then:
- Run
dprint config add malobre/vue
- Install plugins for the languages contained in your vue files.
- Ensure
.vue
file extensions are matched in anincludes
pattern:{ // -- snip -- "includes": [ "**/*.vue" ] }
- Add a
vue
configuration property if desired:{ // -- snip -- "vue": { // vue config goes here } }
Configuration
Key | Default | Description |
---|---|---|
indentTemplate |
true |
Indent the content of the
tag |
indentWidth |
2 |
Width of the indentation |
useTabs |
false |
Use tabs for indentation |