UNPKG

1.63 kBMarkdownView Raw
1# grunt-jsbeautifier
2
3[jsbeautifier.org](http://jsbeautifier.org/) for grunt
4
5## Getting Started
6Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-jsbeautifier`
7
8Then add this line to your project's `grunt.js` gruntfile:
9
10```javascript
11grunt.loadNpmTasks('grunt-jsbeautifier');
12```
13
14[grunt]: http://gruntjs.com/
15[getting_started]: https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md
16
17## Config
18- jsbeautifier
19 - files (required): Your source files to beautify
20 - options (optional): Overwrite default jsbeautifier options
21
22### - Minimum config
23```javascript
24"jsbeautifier" : {
25 files : ["src/**/*.js"]
26}
27```
28
29Default options from jsbeautifier.org will be used
30
31### - Complete config
32```javascript
33"jsbeautifier" : {
34 files : ["src/**/*.js"],
35 options : {
36 "indent_size": 4,
37 "indent_char": " ",
38 "indent_level": 0,
39 "indent_with_tabs": false,
40 "preserve_newlines": true,
41 "max_preserve_newlines": 10,
42 "jslint_happy": false,
43 "brace_style": "collapse",
44 "keep_array_indentation": false,
45 "keep_function_indentation": false,
46 "space_before_conditional": true,
47 "eval_code": false,
48 "indent_case": false,
49 "unescape_strings": false
50 }
51}
52```
53Only specifiy options to overwrite
54
55## Release History
56* 0.1.0: Initial version.
57* 0.1.1: Readme file changes
58* 0.1.2: Supported grunt 0.4~.
59* 0.1.3: Added fix for block comment formatting.
60* 0.1.4: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to latest version (0.3.2)
61
62## License
63Copyright (c) 2012 Vishal Kadam
64Licensed under the MIT license.