diff --git a/README.md b/README.md index f4d33007a..a109d30f5 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,23 @@ # [atom-beautify](https://github.com/donaldpipowitch/atom-beautify) -[Beautify](https://github.com/einars/js-beautify) HTML (including Handlebars), CSS and JavaScript in Atom. +> [Beautify](https://github.com/einars/js-beautify) +HTML (including [Handlebars](http://handlebarsjs.com/)), +CSS (including [Sass](http://sass-lang.com/) and [LESS](http://lesscss.org/)) +and JavaScript in Atom. -*Attention*: A different package with a similar name exist. Maybe you want to visit this one: [Beautifier](https://atom.io/packages/atom-beautifier). +## Language Support + +- JavaScript +- HTML, including + - [Handlebars](http://handlebarsjs.com/) + - XML is supported as an *experimental feature*. +- CSS, including + - [Sass](http://sass-lang.com/) + - [LESS](http://lesscss.org/) ## Usage Open the [Command Palette](https://github.com/atom/command-palette), and type `Beautify`. -This will beautify JS, HTML (including Handlebars), or CSS files. -XML is supported as an experimental feature. It will only beautify selected text, if a selection is found - if not, the whole file will be beautified. @@ -30,9 +39,59 @@ Edit your `.jsbeautifyrc` file in any of the following locations: `atom-beautify` will recursively look up from the current file's directory to find `.jsbeautifyrc`. - Your User's Home directory -You can see examples of both way inside [`examples/`](https://github.com/donaldpipowitch/atom-beautify/tree/master/examples) - -*Comments are supported in `.jsbeautifyrc` thanks to [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).* +**Note**: *Comments are supported in `.jsbeautifyrc` thanks to [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).* + +See examples of both way inside [`examples/`](https://github.com/donaldpipowitch/atom-beautify/tree/master/examples) + +### Simple + +See [examples/simple-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowitch/atom-beautify/blob/master/examples/simple-jsbeautifyrc/.jsbeautifyrc). + +```json +{ + "indent_size": 2, + "indent_char": " ", + "other": " ", + "indent_level": 0, + "indent_with_tabs": false, + "preserve_newlines": true, + "max_preserve_newlines": 2, + "jslint_happy": true, + "indent_handlebars": true +} +``` + +### Nested + +See [examples/nested-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowitch/atom-beautify/blob/master/examples/nested-jsbeautifyrc/.jsbeautifyrc). + +```json +{ + "html": { + "brace_style": "collapse", + "indent_char": " ", + "indent_scripts": "normal", + "indent_size": 6, + "max_preserve_newlines": 1, + "preserve_newlines": true, + "unformatted": ["a", "sub", "sup", "b", "i", "u"], + "wrap_line_length": 0 + }, + "css": { + "indent_char": " ", + "indent_size": 4 + }, + "js": { + "indent_size": 2, + "indent_char": " ", + "indent_level": 0, + "indent_with_tabs": false, + "preserve_newlines": true, + "max_preserve_newlines": 2, + "jslint_happy": true + } +} +``` ## Contributing diff --git a/lib/atom-beautify.js b/lib/atom-beautify.js index 4f4923b32..7c9509ba1 100644 --- a/lib/atom-beautify.js +++ b/lib/atom-beautify.js @@ -254,6 +254,9 @@ function beautify() { case 'XML': text = beautifyHTML(text, getOptions('html', allOptions)); break; + case 'Sass': + case 'SCSS': + case 'LESS': case 'CSS': text = beautifyCSS(text, getOptions('css', allOptions)); break;