Why use this Vue formatter instead of Prettier?
Prettier with the Vue parser is the canonical project-wide formatter — it parses each SFC block with the right grammar (vue-eslint-parser for templates, babel/typescript for script, postcss for style) and re-prints. Use this online tool when you need a one-off reformat without installing anything: paste a .vue file, click Format, copy the result. For a configured project, Prettier remains the better choice because it enforces consistency across hundreds of files.
How are SFC blocks (<template>, <script>, <style>) preserved?
The formatter detects each top-level block by tag name, runs a block-appropriate indenter on its body (HTML-style for <template>, brace-aware for <script>, declaration-style for <style>), and re-emits the block with its original opening tag attributes intact (lang="ts", scoped, setup, src, etc.). Block order is preserved exactly — if your file has <script> before <template>, that order survives.
Does it support <script setup> syntax?
Yes. The <script setup> block uses the same indentation logic as a regular <script> block — the SFC compiler treats setup as an ordinary script with implicit imports and exposed top-level bindings, so the source itself is plain JavaScript or TypeScript. Composition API helpers (ref, computed, watchEffect, defineProps, defineEmits) format normally.
How does it handle Vue directives like v-for and v-if?
Directives are ordinary HTML attributes from a parser perspective — v-for="item in items", v-if="user.active", v-bind:class="cls" (or :class), v-on:click="handler" (or @click), v-model="x", and v-slot are all preserved verbatim. The formatter never modifies attribute values or syntax sugar; it only adjusts whitespace between elements.
Will it format Vue 2 and Vue 3 components the same way?
Yes. The SFC structure (<template>, <script>, <style>) is identical between Vue 2 and Vue 3 — the formatter does not interpret the framework version. Vue 3 features like <script setup>, <Suspense>, <Teleport>, and Fragments (multiple root elements in <template>) all format correctly because they only differ in semantics, not syntax.
Does it handle <style scoped> and CSS preprocessors?
Yes for plain CSS. The <style> block is reformatted with one declaration per line and standard brace placement. For <style lang="scss"> or lang="less" the formatter applies CSS-style rules — nested selectors, at-rules, and variables are kept as-is but rebraced and reindented. For complex Sass/Less nesting, run the dedicated CSS preprocessor formatter instead.
Is the Vue code I paste sent to your servers?
No. Formatting runs entirely in your browser using JavaScript. SFC files containing API endpoints, environment variables embedded in import.meta.env references, or proprietary component logic never leave the device. Open DevTools → Network to verify no requests are made when you click Format.
Will this break my <script setup lang="ts"> TypeScript types?
No. The formatter is whitespace-only inside the script body — it does not parse types or rewrite generic syntax. defineProps<{ name: string }>(), defineEmits<{ (e: "save", id: number): void }>(), and complex type annotations survive intact. The Vue compiler will read the formatted source and emit identical runtime JavaScript.