From a8cb4b4e26bf3eed3b442bf51fd009f05c7c9d36 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Wed, 14 Nov 2018 20:32:03 -0500 Subject: [PATCH 01/17] Update csscomb --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea861a8..32b5f93 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "test": "grunt test" }, "dependencies": { - "csscomb": "~3.1.0" + "csscomb": "~4.2.0" }, "devDependencies": { "grunt": "^0.4.5", From b4efc8540147586e9eb889651d1b3e3a03296b88 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Wed, 14 Nov 2018 21:14:09 -0500 Subject: [PATCH 02/17] Update Node, grunt, and grunt-contrib-jshint --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 32b5f93..72f5eaa 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ ], "main": "Gruntfile.js", "engines": { - "node": ">= 0.10.0" + "node": ">= 8.0.0" }, "scripts": { "test": "grunt test" @@ -46,13 +46,13 @@ "csscomb": "~4.2.0" }, "devDependencies": { - "grunt": "^0.4.5", + "grunt": "^1.0.3", "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-jshint": "^0.11.2", + "grunt-contrib-jshint": "^2.0.0", "grunt-contrib-nodeunit": "^0.4.1" }, "peerDependencies": { - "grunt": ">=0.4.0" + "grunt": ">=1.0.0" }, "keywords": [ "gruntplugin", From 4152bc0d8d2ee2e14e3e7038693a91634682b4ba Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Wed, 14 Nov 2018 21:30:12 -0500 Subject: [PATCH 03/17] Update tests --- package.json | 2 +- test/csscomb_test.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 72f5eaa..46ca4cb 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "grunt": "^1.0.3", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-jshint": "^2.0.0", - "grunt-contrib-nodeunit": "^0.4.1" + "grunt-contrib-nodeunit": "^2.0.0" }, "peerDependencies": { "grunt": ">=1.0.0" diff --git a/test/csscomb_test.js b/test/csscomb_test.js index 2ee9207..e0c984f 100644 --- a/test/csscomb_test.js +++ b/test/csscomb_test.js @@ -8,7 +8,7 @@ exports.csscomb = { var actual = grunt.file.read('test/fixtures/tmp_resort.css'); var expected = grunt.file.read('test/expected/resort.css'); - test.equal(actual, expected, 'sholud be sorted.'); + test.equal(actual, expected, 'should be sorted.'); test.done(); }, @@ -17,7 +17,7 @@ exports.csscomb = { var actual = grunt.file.read('test/fixtures/tmp_customsort.css'); var expected = grunt.file.read('test/expected/customsort.css'); - test.equal(actual, expected, 'sholud be custom sorted.'); + test.equal(actual, expected, 'should be custom sorted.'); test.done(); }, @@ -26,11 +26,11 @@ exports.csscomb = { var actual = grunt.file.read('test/fixtures/tmp_multi1.css'); var expected = grunt.file.read('test/expected/multi1.css'); - test.equal(actual, expected, 'sholud be sorted.'); + test.equal(actual, expected, 'should be sorted.'); var actual2 = grunt.file.read('test/fixtures/tmp_multi2.css'); var expected2 = grunt.file.read('test/expected/multi2.css'); - test.equal(actual2, expected2, 'sholud be sorted.'); + test.equal(actual2, expected2, 'should be sorted.'); test.done(); }, @@ -39,11 +39,11 @@ exports.csscomb = { var actual = grunt.file.read('test/fixtures/dest/multi1.resorted.css'); var expected = grunt.file.read('test/expected/multi1.css'); - test.equal(actual, expected, 'sholud be sorted.'); + test.equal(actual, expected, 'should be sorted.'); var actual2 = grunt.file.read('test/fixtures/dest/multi2.resorted.css'); var expected2 = grunt.file.read('test/expected/multi2.css'); - test.equal(actual2, expected2, 'sholud be sorted.'); + test.equal(actual2, expected2, 'should be sorted.'); test.done(); } From 87a9210eda6f454fe64a34f1e184a85181a70dae Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Wed, 14 Nov 2018 21:36:21 -0500 Subject: [PATCH 04/17] Write combed file after Promise is resolved --- tasks/csscomb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/csscomb.js b/tasks/csscomb.js index 305f3f3..ad897d5 100644 --- a/tasks/csscomb.js +++ b/tasks/csscomb.js @@ -74,14 +74,14 @@ module.exports = function (grunt) { // Get CSS from a source file: var css = grunt.file.read(src); - var combed; // Comb it: grunt.log.ok('Sorting file "' + src + '"...'); var syntax = src.split('.').pop(); try { - combed = comb.processString(css, { syntax: syntax }); - grunt.file.write(f.dest, combed); + comb.processString(css, { syntax: syntax }).then(function(combed) { + grunt.file.write(f.dest, combed); + }); } catch(e) { grunt.log.error(e); } From 2a017869e94b617e0f9b84bbbaa3c826fd50e319 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Wed, 14 Nov 2018 21:41:06 -0500 Subject: [PATCH 05/17] Update grunt-contrib-clean --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 46ca4cb..fb8211f 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ }, "devDependencies": { "grunt": "^1.0.3", - "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-clean": "^2.0.0", "grunt-contrib-jshint": "^2.0.0", "grunt-contrib-nodeunit": "^2.0.0" }, From 108f193df507f7b056588e97c0f459b639a654ad Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Wed, 14 Nov 2018 21:44:49 -0500 Subject: [PATCH 06/17] Use Node 8.x --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1c9c17d..2d6cda3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: - - "0.10" + - "8.0.0" before_script: - npm install grunt-cli \ No newline at end of file From e5093bbddd0486a5c53cafedae24a807a54209f7 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Wed, 28 Nov 2018 05:18:50 -0500 Subject: [PATCH 07/17] Allow Node 6.x --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fb8211f..09f352d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ ], "main": "Gruntfile.js", "engines": { - "node": ">= 8.0.0" + "node": ">= 6.0.0" }, "scripts": { "test": "grunt test" From 9b4dca8ce781a7396156b91bbd1de2244c8a5564 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Thu, 6 Dec 2018 07:37:55 -0500 Subject: [PATCH 08/17] Update package.json and README --- README.md | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2012d08..ce29881 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ grunt.initConfig({ ## Release History ++ v4.0.0: Update csscomb.js to v4; update dependencies. + v3.1.1: Update grunt version. + v3.0.0: Update csscomb.js to v3.0 but `grunt-csscomb` API doesn't change. + v2.0.1: Stop searching config if we reach root directory. diff --git a/package.json b/package.json index 09f352d..a4cabeb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grunt-csscomb", "description": "The grunt plugin for sorting CSS properties in specific order.", - "version": "3.1.1", + "version": "4.0.0", "homepage": "https://github.com/csscomb/grunt-csscomb", "author": [ { From fc25cb20fd59380130ae052ec618136864051d92 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Fri, 7 Dec 2018 09:16:40 -0500 Subject: [PATCH 09/17] Allow src only --- Gruntfile.js | 6 +++++- README.md | 17 ++++++++++++++++- tasks/csscomb.js | 8 ++++++-- test/csscomb_test.js | 13 +++++++++++++ test/fixtures/src/multi1.css | 13 +++++++++++++ test/fixtures/src/multi1.resorted.css | 19 +++++++++++++++++++ test/fixtures/src/multi2.css | 13 +++++++++++++ test/fixtures/src/multi2.resorted.css | 17 +++++++++++++++++ 8 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/src/multi1.css create mode 100644 test/fixtures/src/multi1.resorted.css create mode 100644 test/fixtures/src/multi2.css create mode 100644 test/fixtures/src/multi2.resorted.css diff --git a/Gruntfile.js b/Gruntfile.js index fac8a87..4962be4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -24,7 +24,7 @@ module.exports = function (grunt) { // Before generating any new files, remove any previously-created files. clean: { - tests: ['test/fixtures/tmp_*.css','test/fixtures/dest/*.resorted.css'], + tests: ['test/fixtures/tmp_*.css', 'test/fixtures/dest/*.resorted.css', 'test/fixtures/src/*.resorted.css'], }, // Configuration to be run (and then tested). @@ -54,6 +54,10 @@ module.exports = function (grunt) { src: ['*.css', '!*.resorted.css'], dest: 'test/fixtures/dest/', ext: '.resorted.css' + }, + src_only: { + src: ['test/fixtures/src/*.css', '!test/fixtures/src/*.resorted.css'], + ext: '.resorted.css' } }, diff --git a/README.md b/README.md index ce29881..ed7dff1 100644 --- a/README.md +++ b/README.md @@ -101,9 +101,24 @@ grunt.initConfig({ }); ``` +#### Src Only + +If you provide only a `src` with no value for `dest`, then `dest` will automatically be set to the `src` directory. + +```js +grunt.initConfig({ + csscomb: { + src_only: { + src: ['foo/bar.css'], + ext: '.resorted.css' + } + } +}); +``` + ## Release History -+ v4.0.0: Update csscomb.js to v4; update dependencies. ++ v4.0.0: Update csscomb.js to v4; update dependencies; allow src only. + v3.1.1: Update grunt version. + v3.0.0: Update csscomb.js to v3.0 but `grunt-csscomb` API doesn't change. + v2.0.1: Stop searching config if we reach root directory. diff --git a/tasks/csscomb.js b/tasks/csscomb.js index ad897d5..8f2042a 100644 --- a/tasks/csscomb.js +++ b/tasks/csscomb.js @@ -71,16 +71,20 @@ module.exports = function (grunt) { return true; } }).forEach(function (src) { + var dest = f.dest, + syntax = src.split('.').pop(); + if (!dest) { + dest = grunt.file.expandMapping(src, '', { ext: f.ext || '.' + syntax })[0].dest; + } // Get CSS from a source file: var css = grunt.file.read(src); // Comb it: grunt.log.ok('Sorting file "' + src + '"...'); - var syntax = src.split('.').pop(); try { comb.processString(css, { syntax: syntax }).then(function(combed) { - grunt.file.write(f.dest, combed); + grunt.file.write(dest, combed); }); } catch(e) { grunt.log.error(e); diff --git a/test/csscomb_test.js b/test/csscomb_test.js index e0c984f..aaa323a 100644 --- a/test/csscomb_test.js +++ b/test/csscomb_test.js @@ -45,6 +45,19 @@ exports.csscomb = { var expected2 = grunt.file.read('test/expected/multi2.css'); test.equal(actual2, expected2, 'should be sorted.'); + test.done(); + }, + src_only: function (test) { + test.expect(2); + + var actual = grunt.file.read('test/fixtures/src/multi1.resorted.css'); + var expected = grunt.file.read('test/expected/multi1.css'); + test.equal(actual, expected, 'should be sorted.'); + + var actual2 = grunt.file.read('test/fixtures/src/multi2.resorted.css'); + var expected2 = grunt.file.read('test/expected/multi2.css'); + test.equal(actual2, expected2, 'should be sorted.'); + test.done(); } }; \ No newline at end of file diff --git a/test/fixtures/src/multi1.css b/test/fixtures/src/multi1.css new file mode 100644 index 0000000..c3944af --- /dev/null +++ b/test/fixtures/src/multi1.css @@ -0,0 +1,13 @@ +.multi1 { + z-index: 100; + display: block; + visibility: hidden; + max-height: 44px; + width: 100px; + height: 100px; + border-color: 1px #000 solid; + background-color: red; + vertical-align: 5px; + text-align: center; + font-weight: bold; +} \ No newline at end of file diff --git a/test/fixtures/src/multi1.resorted.css b/test/fixtures/src/multi1.resorted.css new file mode 100644 index 0000000..481901a --- /dev/null +++ b/test/fixtures/src/multi1.resorted.css @@ -0,0 +1,19 @@ +.multi1 +{ + font-weight: bold; + + z-index: 100; + + display: block; + visibility: hidden; + + width: 100px; + height: 100px; + max-height: 44px; + + text-align: center; + vertical-align: 5px; + + border-color: 1px #000 solid; + background-color: red; +} diff --git a/test/fixtures/src/multi2.css b/test/fixtures/src/multi2.css new file mode 100644 index 0000000..2ec4d0b --- /dev/null +++ b/test/fixtures/src/multi2.css @@ -0,0 +1,13 @@ +.multi2 { + position: absolute; + top: 10px; + left: 10px; + z-index: 10; + display: table; + float: left; + margin: 10px; + padding: 10px; + width: 10px; + height: 10px; + border: 1px #fff solid; +} \ No newline at end of file diff --git a/test/fixtures/src/multi2.resorted.css b/test/fixtures/src/multi2.resorted.css new file mode 100644 index 0000000..7af8039 --- /dev/null +++ b/test/fixtures/src/multi2.resorted.css @@ -0,0 +1,17 @@ +.multi2 +{ + position: absolute; + z-index: 10; + top: 10px; + left: 10px; + + display: table; + float: left; + + width: 10px; + height: 10px; + margin: 10px; + padding: 10px; + + border: 1px #fff solid; +} From ccda74073e4816f1e7c3087720ac823187d9abdb Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Thu, 14 Nov 2019 12:45:11 -0500 Subject: [PATCH 10/17] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a4cabeb..34ac53f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grunt-csscomb", "description": "The grunt plugin for sorting CSS properties in specific order.", - "version": "4.0.0", + "version": "4.1.0", "homepage": "https://github.com/csscomb/grunt-csscomb", "author": [ { From 2b5b448e2eda687e2b8f313747da65f19ade6508 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Thu, 14 Nov 2019 12:47:47 -0500 Subject: [PATCH 11/17] Update dependencies --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 34ac53f..d8e27a1 100644 --- a/package.json +++ b/package.json @@ -43,12 +43,12 @@ "test": "grunt test" }, "dependencies": { - "csscomb": "~4.2.0" + "csscomb": "~4.3.0" }, "devDependencies": { - "grunt": "^1.0.3", + "grunt": "^1.0.4", "grunt-contrib-clean": "^2.0.0", - "grunt-contrib-jshint": "^2.0.0", + "grunt-contrib-jshint": "^2.1.0", "grunt-contrib-nodeunit": "^2.0.0" }, "peerDependencies": { From 6865ab59b4b616b190a0e05984f54cf1ce6ba91f Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Thu, 14 Nov 2019 12:53:55 -0500 Subject: [PATCH 12/17] Bump version of Node used by Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2d6cda3..3325c40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: - - "8.0.0" + - "12.3.0" before_script: - npm install grunt-cli \ No newline at end of file From d339002949431475aa28ffe1dc413dbbba893820 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Mon, 5 Oct 2020 20:36:52 -0400 Subject: [PATCH 13/17] Require Node 10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d8e27a1..4a22867 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ ], "main": "Gruntfile.js", "engines": { - "node": ">= 6.0.0" + "node": ">= 10.0.0" }, "scripts": { "test": "grunt test" From 90db067c1eb4fc8b5381c36d64158a1a8386dc66 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Mon, 5 Oct 2020 20:39:28 -0400 Subject: [PATCH 14/17] Update dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4a22867..8225ff4 100644 --- a/package.json +++ b/package.json @@ -46,10 +46,10 @@ "csscomb": "~4.3.0" }, "devDependencies": { - "grunt": "^1.0.4", + "grunt": "^1.3.0", "grunt-contrib-clean": "^2.0.0", "grunt-contrib-jshint": "^2.1.0", - "grunt-contrib-nodeunit": "^2.0.0" + "grunt-contrib-nodeunit": "^2.1.0" }, "peerDependencies": { "grunt": ">=1.0.0" From eab0393dce9aa60bf3a4c25ba23c9dc03d42ad25 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Mon, 5 Oct 2020 20:39:43 -0400 Subject: [PATCH 15/17] Use Node 14 for tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3325c40..0aa55fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: - - "12.3.0" + - "14.13.0" before_script: - npm install grunt-cli \ No newline at end of file From 1c46311544cfe29a6c020ec5932c396f69c10cd7 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Mon, 5 Oct 2020 20:42:01 -0400 Subject: [PATCH 16/17] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed7dff1..a9d7db2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Getting Started -This plugin requires Grunt `>=0.4.x`. +This plugin requires Grunt `>=1.0.x`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: @@ -118,6 +118,8 @@ grunt.initConfig({ ## Release History ++ v4.2.0: Update dependencies. ++ v4.1.0: Update csscomb.js to v4.3.0; update dependencies. + v4.0.0: Update csscomb.js to v4; update dependencies; allow src only. + v3.1.1: Update grunt version. + v3.0.0: Update csscomb.js to v3.0 but `grunt-csscomb` API doesn't change. From 6e0042c4ccea557900f507e49113ab82fe5201f9 Mon Sep 17 00:00:00 2001 From: Noah Cooper Date: Mon, 5 Oct 2020 20:44:56 -0400 Subject: [PATCH 17/17] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8225ff4..00db708 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grunt-csscomb", "description": "The grunt plugin for sorting CSS properties in specific order.", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://github.com/csscomb/grunt-csscomb", "author": [ {