vue-prettier (v0.2.0) is a CLI tool to format .vue single-file components using Prettier. It parses Vue template, script, and style sections individually via vue-template-compiler rather than regex, enabling reliable formatting. Designed as a temporary solution until native Prettier Vue support arrived (which it now has). The package uses the same CLI arguments as Prettier, allowing drop-in replacement. Requires Node >=8 and vue-template-compiler as a peer dependency. Project has seen no updates since 2019 and is effectively superseded by Prettier's built-in Vue support (via @prettier/plugin-vue) since Prettier v1.15+.
npm install vue-prettierVerified import paths — ran on the pinned version, not inferred.
Demonstrates using the formatFile function to prettify a .vue file programmatically. Note: CLI is the primary use case.
Use Prettier >=1.15 with the Vue plugin or Prettier >=2.0 which includes built-in Vue support.
Run: npm install --save-dev vue-template-compiler
Update scripts to use 'vue-prettier' command, or symlink.
Consider using WSL or another tool on Windows.
Switch to Prettier's native Vue support.
npm install --save-dev vue-template-compiler
Use const { formatFile } = require('vue-prettier');Ensure the file path is correct relative to the working directory.