From a54bbda85ba81d354b4a34fdf6ed2ae969b3d219 Mon Sep 17 00:00:00 2001 From: nadir-hussain <60210929+nadir-hussain@users.noreply.github.com> Date: Mon, 12 Oct 2020 11:23:12 +0530 Subject: [PATCH 1/5] Update uncss.js --- tasks/uncss.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tasks/uncss.js b/tasks/uncss.js index cb8eb98..3ffa8d1 100644 --- a/tasks/uncss.js +++ b/tasks/uncss.js @@ -2,7 +2,7 @@ * grunt-uncss * https://github.com/uncss/grunt-uncss * - * Copyright (c) 2020 Addy Osmani + * Copyright (c) 2019 Addy Osmani * Licensed under the MIT license. */ @@ -18,7 +18,7 @@ module.exports = function (grunt) { const options = this.options({ report: 'min' }); - + let fileInProcess = 0; this.files.forEach(file => { const src = file.src.filter(filepath => { if (/^https?:\/\//.test(filepath)) { @@ -40,7 +40,12 @@ module.exports = function (grunt) { } try { + fileInProcess++; uncss(src, options, (error, output, report) => { + fileInProcess--; + if(fileInProcess==0){ + done(); + } if (error) { throw error; } @@ -51,8 +56,6 @@ module.exports = function (grunt) { if (typeof options.reportFile !== 'undefined' && options.reportFile.length > 0) { grunt.file.write(options.reportFile, JSON.stringify(report)); } - - done(); }); } catch (error) { const err = new Error('Uncss failed.'); From 57a81b09cbcb1245a38a9e928f2f57aabfae8f79 Mon Sep 17 00:00:00 2001 From: nadir-hussain <60210929+nadir-hussain@users.noreply.github.com> Date: Mon, 12 Oct 2020 11:31:51 +0530 Subject: [PATCH 2/5] fixed lint issues --- tasks/uncss.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/uncss.js b/tasks/uncss.js index 3ffa8d1..6ec6593 100644 --- a/tasks/uncss.js +++ b/tasks/uncss.js @@ -43,9 +43,10 @@ module.exports = function (grunt) { fileInProcess++; uncss(src, options, (error, output, report) => { fileInProcess--; - if(fileInProcess==0){ + if (fileInProcess === 0){ done(); } + if (error) { throw error; } From 44d0dc7510fab666e47f7a5eb6def19e5b4433ba Mon Sep 17 00:00:00 2001 From: nadir-hussain <60210929+nadir-hussain@users.noreply.github.com> Date: Mon, 12 Oct 2020 11:34:05 +0530 Subject: [PATCH 3/5] remove trailing spaces --- tasks/uncss.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/uncss.js b/tasks/uncss.js index 6ec6593..3f4c025 100644 --- a/tasks/uncss.js +++ b/tasks/uncss.js @@ -43,10 +43,10 @@ module.exports = function (grunt) { fileInProcess++; uncss(src, options, (error, output, report) => { fileInProcess--; - if (fileInProcess === 0){ + if (fileInProcess === 0) { done(); } - + if (error) { throw error; } From a619dd5c5a35776842a7731d3145372a6deda278 Mon Sep 17 00:00:00 2001 From: nadir-hussain <60210929+nadir-hussain@users.noreply.github.com> Date: Mon, 12 Oct 2020 11:41:09 +0530 Subject: [PATCH 4/5] revert copyright year change --- tasks/uncss.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/uncss.js b/tasks/uncss.js index 3f4c025..1748434 100644 --- a/tasks/uncss.js +++ b/tasks/uncss.js @@ -2,7 +2,7 @@ * grunt-uncss * https://github.com/uncss/grunt-uncss * - * Copyright (c) 2019 Addy Osmani + * Copyright (c) 2020 Addy Osmani * Licensed under the MIT license. */ From dfaec317dad74b5d3633059485533f3a78fa92ad Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 20 Dec 2020 16:05:55 +0200 Subject: [PATCH 5/5] Update uncss.js --- tasks/uncss.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/uncss.js b/tasks/uncss.js index 1748434..d22ea58 100644 --- a/tasks/uncss.js +++ b/tasks/uncss.js @@ -18,7 +18,9 @@ module.exports = function (grunt) { const options = this.options({ report: 'min' }); + let fileInProcess = 0; + this.files.forEach(file => { const src = file.src.filter(filepath => { if (/^https?:\/\//.test(filepath)) {