diff --git a/.travis.yml b/.travis.yml index 432dbd02..f98fed06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: node_js node_js: - - '11' + - '12' - '10' - '8' - - '6' diff --git a/README.md b/README.md index 94da9d3d..2fcf8448 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ comb.processPath('assets/css'); This project is actively mantained. But anyone and everyone is welcome to contribute. Please take a moment to review the [guidelines for contributing](CONTRIBUTING.md). -Also you can become a mantainer. To do that please ping +Also you can become a maintainer. To do that please ping [@tonyganch](https://github.com/tonyganch). ## Authors diff --git a/src/options/sort-order.js b/src/options/sort-order.js index 91b9c679..141734b6 100644 --- a/src/options/sort-order.js +++ b/src/options/sort-order.js @@ -385,6 +385,14 @@ module.exports = { a = a.node.first().first().content; b = b.node.first().first().content; + if (Array.isArray(a)) { + a = a[0].content; + } + + if (Array.isArray(b)) { + b = b[0].content; + } + // Get prefix and unprefixed part. For example: // ['-o-animation', '-o-', 'animation'] // ['color', '', 'color'] diff --git a/test/options/sort-order-fallback/process/scss/leftovers-variable.expected.scss b/test/options/sort-order-fallback/process/scss/leftovers-variable.expected.scss new file mode 100644 index 00000000..a7d2eca2 --- /dev/null +++ b/test/options/sort-order-fallback/process/scss/leftovers-variable.expected.scss @@ -0,0 +1 @@ +div {$blue: steelblue; $red: tomato; } diff --git a/test/options/sort-order-fallback/process/scss/leftovers-variable.scss b/test/options/sort-order-fallback/process/scss/leftovers-variable.scss new file mode 100644 index 00000000..efe7eb6c --- /dev/null +++ b/test/options/sort-order-fallback/process/scss/leftovers-variable.scss @@ -0,0 +1 @@ +div {$red: tomato; $blue: steelblue; } diff --git a/test/options/sort-order-fallback/process/test.js b/test/options/sort-order-fallback/process/test.js index 9127d943..6ef495e0 100644 --- a/test/options/sort-order-fallback/process/test.js +++ b/test/options/sort-order-fallback/process/test.js @@ -41,4 +41,15 @@ describe('Option `sort-order-fallback`, process', function() { return test.shouldBeEqual('test.css', 'test-3.expected.css'); }); }); + + describe('scss', function() { + it('Should sort leftover variables alphabetically', function() { + let config = { + 'sort-order': [], + 'sort-order-fallback': 'abc' + }; + let test = new Test(this, config); + return test.shouldBeEqual('leftovers-variable.scss', 'leftovers-variable.expected.scss'); + }); + }); }); diff --git a/test/options/sort-order/process/scss/variable.expected.scss b/test/options/sort-order/process/scss/variable.expected.scss index c17c6341..a7359b10 100644 --- a/test/options/sort-order/process/scss/variable.expected.scss +++ b/test/options/sort-order/process/scss/variable.expected.scss @@ -1 +1 @@ -div {$red: tomato; color: $tomato; } +div {$red: tomato; color: $red; } diff --git a/test/options/sort-order/process/scss/variable.scss b/test/options/sort-order/process/scss/variable.scss index f759f22c..967fd4f0 100644 --- a/test/options/sort-order/process/scss/variable.scss +++ b/test/options/sort-order/process/scss/variable.scss @@ -1 +1 @@ -div { color: $tomato; $red: tomato; } +div { color: $red; $red: tomato; }