An open API service indexing awesome lists of open source software.

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

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