Permalink
Browse files

Updated readme for 0.2.0

  • Loading branch information...
1 parent c154bf8 commit af9d35d31b408bd35d672206d788a9f4168ebc58 @vkadam committed Aug 3, 2013
Showing with 65 additions and 62 deletions.
  1. +1 −0 .gitignore
  2. +6 −4 Gruntfile.js
  3. +53 −53 README.md
  4. +5 −5 tasks/jsbeautifier.js
View
@@ -1,3 +1,4 @@
.DS_Store
/node_modules
*.log
+.idea
View
@@ -4,22 +4,24 @@ module.exports = function(grunt) {
grunt.initConfig({
jsbeautifier: {
default: {
- src: ["package.json", "<%= jshint.files %>", "!test/fixtures/not-been-beautified.js"]
+ src: ["<%= jshint.files %>", "!test/fixtures/not-been-beautified.js"]
},
has_not_been_beautified: {
src: ["test/fixtures/not-been-beautified.js"],
options: {
- mode: "VERIFY_ONLY"
+ "mode": "VERIFY_ONLY"
}
},
has_been_beautified: {
src: ["test/fixtures/been-beautified.js"],
options: {
- mode: "VERIFY_ONLY"
+ "mode": "VERIFY_ONLY"
}
},
options: {
- indent_size: 4
+ "js": {
+ "indent_size": 4
+ }
}
},
nodeunit: {
View
@@ -94,71 +94,71 @@ The file path (relative to your process's cwd) to the config file. This is usual
### Default options from jsbeautifier.org can be used
```javascript
-"jsbeautifier" : {
- files : ["src/**/*.js"],
- options : {
- {
- "html": {
- "brace_style": "collapse",
- "indent_char": " ",
- "indent_scripts": "keep",
- "indent_size": 4,
- "max_preserve_newlines": 10,
- "preserve_newlines": true,
- "unformatted": ["a", "sub", "sup", "b", "i", "u"],
- "wrap_line_length": 0
- },
- "css": {
- "indent_char": " ",
- "indent_size": 4
- },
- "js": {
- "brace_style": "collapse",
- "break_chained_methods": false,
- "e4x": false,
- "eval_code": false,
- "indent_char": " ",
- "indent_level": 0,
- "indent_size": 4,
- "indent_with_tabs": false,
- "jslint_happy": false,
- "keep_array_indentation": false,
- "keep_function_indentation": false,
- "max_preserve_newlines": 10,
- "preserve_newlines": true,
- "space_before_conditional": true,
- "space_in_paren": false,
- "unescape_strings": false,
- "wrap_line_length": 0
- }
+"jsbeautifier": {
+ files: ["src/**/*.js"],
+ config: "path/to/configFile",
+ options: {
+ "html": {
+ "brace_style": "collapse",
+ "indent_char": " ",
+ "indent_scripts": "keep",
+ "indent_size": 4,
+ "max_preserve_newlines": 10,
+ "preserve_newlines": true,
+ "unformatted": ["a", "sub", "sup", "b", "i", "u"],
+ "wrap_line_length": 0
+ },
+ "css": {
+ "indent_char": " ",
+ "indent_size": 4
+ },
+ "js": {
+ "brace_style": "collapse",
+ "break_chained_methods": false,
+ "e4x": false,
+ "eval_code": false,
+ "indent_char": " ",
+ "indent_level": 0,
+ "indent_size": 4,
+ "indent_with_tabs": false,
+ "jslint_happy": false,
+ "keep_array_indentation": false,
+ "keep_function_indentation": false,
+ "max_preserve_newlines": 10,
+ "preserve_newlines": true,
+ "space_before_conditional": true,
+ "space_in_paren": false,
+ "unescape_strings": false,
+ "wrap_line_length": 0
+ }
}
- }
-}
+},
```
Only specifiy options to overwrite
### Tips
#### 1. Exclude files
All files from foo folder except bar.js
```javascript
- jsbeautifier: {
- files: ['foo/*.js', '!foo/bar.js']
- }
+jsbeautifier: {
+ files: ['foo/*.js', '!foo/bar.js']
+}
```
## Release History
-* 0.1.0: Initial version.
-* 0.1.1: Readme file changes
-* 0.1.2: Supported grunt 0.4~.
-* 0.1.3: Added fix for block comment formatting.
-* 0.1.4: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to latest version (0.3.2)
-* 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)
-* 0.1.6: Make sure new line at the end of file. Fixed issue [5](https://github.com/vkadam/grunt-jsbeautifier/issues/5)
-* 0.1.7: Upgraded grunt to ~0.4.1, [js-beautify](https://npmjs.org/package/js-beautify) to ~1.2.0. Fixed issues [6](https://github.com/vkadam/grunt-jsbeautifier/issues/6), [7](https://github.com/vkadam/grunt-jsbeautifier/issues/7), [8](https://github.com/vkadam/grunt-jsbeautifier/issues/8), [9](https://github.com/vkadam/grunt-jsbeautifier/issues/9)
-* 0.1.8: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to ~1.3.1. Fixed issues [10](https://github.com/vkadam/grunt-jsbeautifier/issues/10), [12](https://github.com/vkadam/grunt-jsbeautifier/issues/12)
-* 0.1.9: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to 1.4.0. Fixed issues [13](https://github.com/vkadam/grunt-jsbeautifier/issues/13)
+* 0.2.0: Added support for css, html and json files
* 0.1.10: Added verify only mode [15](https://github.com/vkadam/grunt-jsbeautifier/issues/15). This will fail if any file needs beautification.
+* 0.1.9: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to 1.4.0. Fixed issues [13](https://github.com/vkadam/grunt-jsbeautifier/issues/13)
+* 0.1.8: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to ~1.3.1. Fixed issues [10](https://github.com/vkadam/grunt-jsbeautifier/issues/10), [12](https://github.com/vkadam/grunt-jsbeautifier/issues/12)
+* 0.1.7: Upgraded grunt to ~0.4.1, [js-beautify](https://npmjs.org/package/js-beautify) to ~1.2.0. Fixed issues [6](https://github.com/vkadam/grunt-jsbeautifier/issues/6), [7](https://github.com/vkadam/grunt-jsbeautifier/issues/7), [8](https://github.com/vkadam/grunt-jsbeautifier/issues/8), [9](https://github.com/vkadam/grunt-jsbeautifier/issues/9)
+* 0.1.6: Make sure new line at the end of file. Fixed issue [5](https://github.com/vkadam/grunt-jsbeautifier/issues/5)
+* 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)
+* 0.1.4: Upgraded [js-beautify](https://npmjs.org/package/js-beautify) to latest version (0.3.2)
+* 0.1.3: Added fix for block comment formatting.
+* 0.1.2: Supported grunt 0.4~.
+* 0.1.1: Readme file changes
+* 0.1.0: Initial version.
## License
Copyright (c) 2012 Vishal Kadam
-Licensed under the MIT license.
+Licensed under the MIT license.
View
@@ -1,12 +1,12 @@
module.exports = function(grunt) {
"use strict";
- var path = require('path');
+ var path = require('path'),
+ js_beautifier = require('js-beautify'),
+ jsbeautifier = js_beautifier.js,
+ cssbeautifier = js_beautifier.css,
+ htmlbeautifier = js_beautifier.html;
- var js_beautifier = require('js-beautify');
- var jsbeautifier = js_beautifier.js;
- var cssbeautifier = js_beautifier.css;
- var htmlbeautifier = js_beautifier.html;
// Please see the grunt documentation for more information regarding task and
// helper creation: https://github.com/gruntjs/grunt/blob/master/docs/toc.md
// ==========================================================================

0 comments on commit af9d35d

Please sign in to comment.