UNPKG

2.54 kBMarkdownView Raw
1# grunt-jsbeautifier
2
3[jsbeautifier.org](http://jsbeautifier.org/) for grunt
4
5## Getting Started
6This plugin recommends using Grunt `~0.4.0`. Grunt `~0.3.0` is only suported till version 0.1.4
7
8If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
9
10### Grunt `~0.4.0`
11```
12npm install grunt-jsbeautifier --save-dev
13```
14
15One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
16
17```
18grunt.loadNpmTasks('grunt-jsbeautifier');
19```
20
21### Grunt `~0.3.0`
22Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with:
23
24```
25npm install grunt-jsbeautifier@0.1.4
26```
27
28Then add this line to your project's `grunt.js` gruntfile:
29
30```
31grunt.loadNpmTasks('grunt-jsbeautifier');
32```
33
34[grunt]: http://gruntjs.com/
35[getting_started]: https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md
36
37## Config
38- jsbeautifier
39 - files (required): Your source files to beautify
40 - options (optional): Overwrite default jsbeautifier options
41
42### - Minimum config
43```
44"jsbeautifier" : {
45 files : ["src/**/*.js"]
46}
47```
48
49Default options from jsbeautifier.org will be used
50
51### - Complete config
52```
53"jsbeautifier" : {
54 files : ["src/**/*.js"],
55 options : {
56 "indent_size": 4,
57 "indent_char": " ",
58 "indent_level": 0,
59 "indent_with_tabs": false,
60 "preserve_newlines": true,
61 "max_preserve_newlines": 10,
62 "jslint_happy": false,
63 "brace_style": "collapse",
64 "keep_array_indentation": false,
65 "keep_function_indentation": false,
66 "space_before_conditional": true,
67 "eval_code": false,
68 "indent_case": false,
69 "unescape_strings": false
70 }
71}
72```
73Only specifiy options to overwrite
74
75## Release History
76* 0.1.0: Initial version.
77* 0.1.1: Readme file changes
78* 0.1.2: Supported grunt 0.4~.
79* 0.1.3: Added fix for block comment formatting.
80* 0.1.4: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to latest version (0.3.2)
81* 0.1.5: Upgraded to grunt ~0.4.0. Fixed issues [2](https://github.com/vkadam/grunt-jsbeautifier/issues/2), [3](https://github.com/vkadam/grunt-jsbeautifier/issues/3), [4](https://github.com/vkadam/grunt-jsbeautifier/issues/4)
82
83## License
84Copyright (c) 2012 Vishal Kadam
85Licensed under the MIT license.
\No newline at end of file