https://github.com/maranimatias/vue-formatter
vue-beautifier for node
https://github.com/maranimatias/vue-formatter
beautifier cli command-line formatter node-module npm-package vim vim-plugin vue vuejs
Last synced: 10 months ago
JSON representation
vue-beautifier for node
- Host: GitHub
- URL: https://github.com/maranimatias/vue-formatter
- Owner: MaraniMatias
- License: mit
- Created: 2017-09-02T16:21:30.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-10T20:31:42.000Z (over 5 years ago)
- Last Synced: 2025-08-09T18:45:39.789Z (10 months ago)
- Topics: beautifier, cli, command-line, formatter, node-module, npm-package, vim, vim-plugin, vue, vuejs
- Language: Vue
- Size: 44.9 KB
- Stars: 21
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-formatter
vue-beautifier for node
```shell
npm install -g vue-formatter
```
## Using
### Cli
```shell
cat my-compnet.vue | vue-formatter | sponge my-compnet.vue
```
or alternatively
```shell
cat my-compnet.vue | vue-formatter > my-compnet.vue.tmp && mv my-compnet.vue.tmp my-compnet.vue
```
### JavaScript
```shell
npm install vue-formatter
```
```javascript
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));
});
```
### Using on VIM
Key map on `.vimrc`
```shell
autocmd FileType vue noremap :%!vue-formatter
```
## Defaults options for JS-beautify
```json
{
"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