vue-beautifier for node
npm install -g vue-formatter
cat my-compnet.vue | vue-formatter | sponge my-compnet.vue
or alternatively
cat my-compnet.vue | vue-formatter > my-compnet.vue.tmp && mv my-compnet.vue.tmp my-compnet.vue
npm install vue-formatter
const formatter = require('vue-formatter');
const fs = require('fs');
fs.readFile('foo.vue', 'utf8', function (err, data) {
if (err) { throw err; }
console.log(formatter(data));
});
Key map on .vimrc
autocmd FileType vue noremap <buffer> <c-f> :%!vue-formatter<CR>
{
"indent_size": 2,
"indent_char": " ",
"indent_with_tabs": false,
"eol": "\n",
"end_with_newline": false,
"indent_level": 0,
"preserve_newlines": true,
"max_preserve_newlines": 3,
"space_in_paren": false,
"space_in_empty_paren": false,
"jslint_happy": true,
"space_after_anon_function": true,
"brace_style": "collapse,preserve-inline",
"break_chained_methods": false,
"keep_array_indentation": true,
"unescape_strings": false,
"wrap_line_length": 0,
"e4x": false,
"comma_first": false,
"operator_position": "before-newline"
}
Donate
Bitcoin 3GonBQ8XibkL9d5SDu5j7MccavV1VKXXet
Ethereum 0xf3ca8c0630ceee045f715b5c596e70887a903d38
Monero 86sR1arBcYW918Bf8NhN3bCynwGfbzMna48KfsffHi8L1UEKqwu6FVRR3canexk3jfByB99gWB5bSFxvAt2ZneigLmSNxJB