diff --git a/docs/options.md b/docs/options.md index 3e3ab33..7fa34f9 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1417,6 +1417,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `align_assignments` | :x: | :x: | :white_check_mark: | | `configPath` | :white_check_mark: | :x: | :x: | | `convert_quotes` | :x: | :x: | :white_check_mark: | +| `end_with_newline` | :x: | :white_check_mark: | :x: | | `force_indentation` | :x: | :x: | :white_check_mark: | | `indent_char` | :x: | :white_check_mark: | :white_check_mark: | | `indent_comments` | :x: | :x: | :white_check_mark: | @@ -1563,6 +1564,30 @@ Convert the quote characters delimiting strings from either double or single quo } ``` +##### [End with newline](#end-with-newline) + +**Namespace**: `css` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +End output with newline (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "css": { + "end_with_newline": false + } +} +``` + ##### [Force indentation](#force-indentation) **Namespace**: `css` @@ -1671,6 +1696,8 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Key**: `newline_between_rules` +**Default**: `true` + **Type**: `boolean` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) @@ -1684,7 +1711,7 @@ Add a newline between CSS rules (Supported by JS Beautify, Pretty Diff) ```json { "css": { - "newline_between_rules": false + "newline_between_rules": true } } ``` @@ -6006,6 +6033,8 @@ Indentation size/length (Supported by Pretty Diff) **Key**: `newline_between_rules` +**Default**: `true` + **Type**: `boolean` **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -6019,7 +6048,7 @@ Add a newline between CSS rules (Supported by Pretty Diff) ```json { "css": { - "newline_between_rules": false + "newline_between_rules": true } } ``` @@ -8775,6 +8804,8 @@ Indentation size/length (Supported by Pretty Diff) **Key**: `newline_between_rules` +**Default**: `true` + **Type**: `boolean` **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -8788,7 +8819,7 @@ Add a newline between CSS rules (Supported by Pretty Diff) ```json { "css": { - "newline_between_rules": false + "newline_between_rules": true } } ``` @@ -9158,6 +9189,8 @@ Indentation size/length (Supported by Pretty Diff) **Key**: `newline_between_rules` +**Default**: `true` + **Type**: `boolean` **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -9171,7 +9204,7 @@ Add a newline between CSS rules (Supported by Pretty Diff) ```json { "css": { - "newline_between_rules": false + "newline_between_rules": true } } ``` @@ -10200,6 +10233,8 @@ Indentation size/length (Supported by Pretty Diff) **Key**: `newline_between_rules` +**Default**: `true` + **Type**: `boolean` **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -10213,7 +10248,7 @@ Add a newline between CSS rules (Supported by Pretty Diff) ```json { "css": { - "newline_between_rules": false + "newline_between_rules": true } } ``` @@ -12791,6 +12826,8 @@ Add a newline between multiple selectors (Supported by JS Beautify) **Key**: `newline_between_rules` +**Default**: `true` + **Type**: `boolean` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) @@ -12804,7 +12841,7 @@ Add a newline between CSS rules (Supported by JS Beautify, Pretty Diff) ```json { "css": { - "newline_between_rules": false + "newline_between_rules": true } } ``` @@ -12861,6 +12898,30 @@ Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff) } ``` +##### [End with newline](#end-with-newline) + +**Namespace**: `html` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +End output with newline (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "end_with_newline": false + } +} +``` + ##### [Indent inner html](#indent-inner-html) **Namespace**: `html` @@ -13085,30 +13146,6 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J } ``` -##### [End with newline](#end-with-newline) - -**Namespace**: `html` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -End output with newline (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "end_with_newline": false - } -} -``` - ##### [Extra liners](#extra-liners) **Namespace**: `html` @@ -14316,6 +14353,8 @@ Preserve line-breaks (Supported by Pretty Diff) **Key**: `newline_between_rules` +**Default**: `true` + **Type**: `boolean` **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -14329,7 +14368,7 @@ Add a newline between CSS rules (Supported by Pretty Diff) ```json { "css": { - "newline_between_rules": false + "newline_between_rules": true } } ``` diff --git a/examples/nested-jsbeautifyrc/less/expected/test.less b/examples/nested-jsbeautifyrc/less/expected/test.less index 3a41133..ce48f0a 100644 --- a/examples/nested-jsbeautifyrc/less/expected/test.less +++ b/examples/nested-jsbeautifyrc/less/expected/test.less @@ -4,24 +4,30 @@ a { display: block; padding: 0 15px; font-size: 16px; + button { font-size: 16px; } + &:link { color: @white; text-decoration: none; } + &:visited { color: @white; } + &:hover { color: @orange; } + &.green { color: @green; + &:hover { color: @white; diff --git a/examples/nested-jsbeautifyrc/less/expected/test2.less b/examples/nested-jsbeautifyrc/less/expected/test2.less index 2a4eacc..22bbcf7 100644 --- a/examples/nested-jsbeautifyrc/less/expected/test2.less +++ b/examples/nested-jsbeautifyrc/less/expected/test2.less @@ -27,10 +27,12 @@ background-color: firebrick; padding: 5px 7px; border-radius: 20px; + &:hover { background-color: lighten(@black, 50%); cursor: pointer; } + &:active { background-color: lighten(@black, 25%); } @@ -85,9 +87,11 @@ .styleLinks(@white, darken(@white, 10%)); padding: 5px; text-transform: uppercase; + &:hover { background-color: fade(@white, 15%); } + &:active { background-color: fade(@white, 30%); } diff --git a/examples/nested-jsbeautifyrc/less/expected/test3.less b/examples/nested-jsbeautifyrc/less/expected/test3.less index 8952106..3756f4b 100644 --- a/examples/nested-jsbeautifyrc/less/expected/test3.less +++ b/examples/nested-jsbeautifyrc/less/expected/test3.less @@ -1,4 +1,5 @@ // Breaks (fixed now) + .mixin(@variable, @anotherVariable) {} // Works .mixin(@variable; @anotherVariable) {} diff --git a/examples/nested-jsbeautifyrc/less/expected/test4.less b/examples/nested-jsbeautifyrc/less/expected/test4.less index f901b7e..e263cf3 100644 --- a/examples/nested-jsbeautifyrc/less/expected/test4.less +++ b/examples/nested-jsbeautifyrc/less/expected/test4.less @@ -5,11 +5,13 @@ section#photo-details { div.photo-view { text-align: center; + figure { box-shadow: 0 0 3px 1px rgba(0,0,0,0.75); display: inline-block; margin: 0 0 60px; padding: 0; + img { display: block; } diff --git a/examples/nested-jsbeautifyrc/less/expected/test5.less b/examples/nested-jsbeautifyrc/less/expected/test5.less index 14bbf87..c0bef16 100644 --- a/examples/nested-jsbeautifyrc/less/expected/test5.less +++ b/examples/nested-jsbeautifyrc/less/expected/test5.less @@ -1,8 +1,10 @@ .animal { color: red; } + .dog { &:extend(.animal); + &:hover { color: green; } diff --git a/examples/nested-jsbeautifyrc/sass/expected/interpolated-text-vars.scss b/examples/nested-jsbeautifyrc/sass/expected/interpolated-text-vars.scss index bd5209d..a8e0607 100644 --- a/examples/nested-jsbeautifyrc/sass/expected/interpolated-text-vars.scss +++ b/examples/nested-jsbeautifyrc/sass/expected/interpolated-text-vars.scss @@ -2,6 +2,7 @@ #{$parent} { color: $color; } + a#{$parent}:hover { color: darken($color, 10%); } diff --git a/examples/nested-jsbeautifyrc/sass/expected/kendo_ui.scss b/examples/nested-jsbeautifyrc/sass/expected/kendo_ui.scss index 180b941..1932b5a 100644 --- a/examples/nested-jsbeautifyrc/sass/expected/kendo_ui.scss +++ b/examples/nested-jsbeautifyrc/sass/expected/kendo_ui.scss @@ -6,13 +6,16 @@ background-color: $gray-light; box-shadow: none; } + .k-slider-selection { background-color: $brand-primary; } + .k-button { border: 1px solid $brand-primary; background-color: transparent; color: $brand-primary; + &:hover { border-color: $brand-primary; background-color: $brand-primary; diff --git a/examples/nested-jsbeautifyrc/sass/expected/test.sass b/examples/nested-jsbeautifyrc/sass/expected/test.sass index 2e46de6..e80858a 100644 --- a/examples/nested-jsbeautifyrc/sass/expected/test.sass +++ b/examples/nested-jsbeautifyrc/sass/expected/test.sass @@ -1,5 +1,6 @@ a { line-height: 56px; + &:hover { color: blue; } diff --git a/examples/nested-jsbeautifyrc/sass/expected/test.scss b/examples/nested-jsbeautifyrc/sass/expected/test.scss index 6b6bd67..930e935 100644 --- a/examples/nested-jsbeautifyrc/sass/expected/test.scss +++ b/examples/nested-jsbeautifyrc/sass/expected/test.scss @@ -4,6 +4,7 @@ &:visited { //whatever } + &::before { //whatever } diff --git a/src/languages/css.coffee b/src/languages/css.coffee index 7db8315..bb2ee9b 100644 --- a/src/languages/css.coffee +++ b/src/languages/css.coffee @@ -45,7 +45,7 @@ module.exports = { description: "Add a newline between multiple selectors" newline_between_rules: type: 'boolean' - default: false + default: true description: "Add a newline between CSS rules" preserve_newlines: type: 'boolean'