Skip to content

Commit

Permalink
Closes #20. Add Sass and LESS support. Update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavin001 committed Jun 13, 2014
1 parent c34f6f9 commit eacf232
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 7 deletions.
73 changes: 66 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions lib/atom-beautify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eacf232

Please sign in to comment.