From 95799d13f87be35d2b6df42649933218eb43d598 Mon Sep 17 00:00:00 2001 From: Christian Wenz Date: Mon, 27 Apr 2020 16:41:50 +0200 Subject: [PATCH 01/96] Update README.md (stress that it's -O, not -0) (#42) Fixes #38 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9decfe8..a35051c 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,8 @@ or a fine-grained configuration given via a string. Please note that level 1 optimization options are generally safe while level 2 optimizations should be safe for most users. +Important: The `-O` option is using the capital letter O (as in "Oscar"), not the number zero. + ### Level 0 optimizations Level 0 optimizations simply means "no optimizations". Use it when you'd like to inline imports and / or rebase URLs but skip everything else, e.g. From c219da1afc493c076fffddd0b392af14eebb2b0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Feb 2021 14:08:06 +0100 Subject: [PATCH 02/96] Bump http-proxy from 1.17.0 to 1.18.1 (#45) Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.17.0 to 1.18.1. - [Release notes](https://github.com/http-party/node-http-proxy/releases) - [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md) - [Commits](https://github.com/http-party/node-http-proxy/compare/1.17.0...1.18.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index 727be62..762bc74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,15 +74,6 @@ "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", "dev": true }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, "diff": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/diff/-/diff-1.0.8.tgz", @@ -139,9 +130,9 @@ "dev": true }, "eventemitter3": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, "exit": { @@ -157,13 +148,10 @@ "dev": true }, "follow-redirects": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz", - "integrity": "sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==", - "dev": true, - "requires": { - "debug": "^3.2.6" - } + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", + "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==", + "dev": true }, "fs.realpath": { "version": "1.0.0", @@ -197,12 +185,12 @@ } }, "http-proxy": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", - "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "dev": true, "requires": { - "eventemitter3": "^3.0.0", + "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", "requires-port": "^1.0.0" } @@ -257,12 +245,6 @@ "brace-expansion": "^1.1.7" } }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", From b12305fd367ce5b740e36af1f7958e0ff137df0d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Feb 2021 14:09:18 +0100 Subject: [PATCH 03/96] Bump lodash from 4.17.15 to 4.17.19 (#43) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 762bc74..40e5433 100644 --- a/package-lock.json +++ b/package-lock.json @@ -232,9 +232,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "minimatch": { From 554853be2808801b753434e9de0ce1d11d6ba045 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 3 Feb 2021 14:23:49 +0100 Subject: [PATCH 04/96] See #30 - explains what "-O" prefix is. --- README.md | 2 +- index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a35051c..f424375 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ clean-css-cli 4.3 introduces the following changes / features: -d, --debug Shows debug information (minification time & compression efficiency) -f, --format Controls output formatting, see examples below -o, --output [output-file] Use [output-file] as output instead of STDOUT --O [optimizations] Turn on level optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below +-O [optimizations] Turn on level optimizations; optionally accepts a list of fine-grained options, defaults to `1`, IMPORTANT: the prefix is O (a capital o letter), NOT a 0 (zero, a number) --inline [rules] Enables inlining for listed sources (defaults to `local`) --inline-timeout [seconds] Per connection timeout when fetching remote stylesheets (defaults to 5 seconds) --remove-inlined-files Remove files inlined in or via `@import` statements diff --git a/index.js b/index.js index ff8c0bc..d68b3ba 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ function cli(process, beforeMinifyCallback) { .option('-d, --debug', 'Shows debug information (minification time & compression efficiency)') .option('-f, --format ', 'Controls output formatting, see examples below') .option('-o, --output [output-file]', 'Use [output-file] as output instead of STDOUT') - .option('-O [optimizations]', 'Turn on level optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below', function (val) { return Math.abs(parseInt(val)); }) + .option('-O [optimizations]', 'Turn on level optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below, IMPORTANT: the prefix is O (a capital o letter), NOT a 0 (zero, a number)', function (val) { return Math.abs(parseInt(val)); }) .option('--inline [rules]', 'Enables inlining for listed sources (defaults to `local`)') .option('--inline-timeout [seconds]', 'Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)', parseFloat) .option('--remove-inlined-files', 'Remove files inlined in or via `@import` statements') From a4f6e10b7a3556e13b22ebc3c2e1487072c8e167 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 3 Feb 2021 14:43:15 +0100 Subject: [PATCH 05/96] Updates packages to latest versions within dependency range. --- package-lock.json | 68 ++++++++++++++++++++++++++--------------------- package.json | 8 +++--- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index 40e5433..d0fe8ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.1.tgz", - "integrity": "sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.3.tgz", + "integrity": "sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==", "requires": { "source-map": "~0.6.0" }, @@ -44,9 +44,9 @@ } }, "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==" + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, "concat-map": { "version": "0.0.1", @@ -75,25 +75,31 @@ "dev": true }, "diff": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/diff/-/diff-1.0.8.tgz", - "integrity": "sha1-NDJ2MI7Jkbe8giZ+1VvBQR+XFmY=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, "dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", "dev": true, "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" + "domelementtype": "^2.0.1", + "entities": "^2.0.0" }, "dependencies": { + "domelementtype": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz", + "integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==", + "dev": true + }, "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", "dev": true } } @@ -159,9 +165,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -216,25 +222,25 @@ "dev": true }, "jshint": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.10.2.tgz", - "integrity": "sha512-e7KZgCSXMJxznE/4WULzybCMNXNAd/bf5TSrvVEq78Q/K8ZwFpmBqQeDtNiHc3l49nV4E/+YeHU/JZjSUIrLAA==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.12.0.tgz", + "integrity": "sha512-TwuuaUDmra0JMkuqvqy+WGo2xGHSNjv1BA1nTIgtH2K5z1jHuAEeAgp7laaR+hLRmajRjcrM71+vByBDanCyYA==", "dev": true, "requires": { "cli": "~1.0.0", "console-browserify": "1.1.x", "exit": "0.1.x", "htmlparser2": "3.8.x", - "lodash": "~4.17.11", + "lodash": "~4.17.19", "minimatch": "~3.0.2", "shelljs": "0.3.x", "strip-json-comments": "1.0.x" } }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "dev": true }, "minimatch": { @@ -301,12 +307,12 @@ "dev": true }, "vows": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/vows/-/vows-0.8.2.tgz", - "integrity": "sha1-aR95qybM3oC6cm3en+yOc9a88us=", + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/vows/-/vows-0.8.3.tgz", + "integrity": "sha512-PVIxa/ovXhrw5gA3mz6M+ZF3PHlqX4tutR2p/y9NWPAaFVKcWBE8b2ktfr0opQM/qFmcOVWKjSCJVjnYOvjXhw==", "dev": true, "requires": { - "diff": "~1.0.8", + "diff": "^4.0.1", "eyes": "~0.1.6", "glob": "^7.1.2" } diff --git a/package.json b/package.json index 6b0b58b..1ac8d3e 100644 --- a/package.json +++ b/package.json @@ -34,14 +34,14 @@ "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", "dependencies": { "clean-css": "^4.2.1", - "commander": "2.x", - "glob": "7.x" + "commander": "^2.20.3", + "glob": "^7.1.6" }, "devDependencies": { "http-proxy": "1.x", - "jshint": "2.x", + "jshint": "^2.12.0", "source-map": "0.5.x", - "vows": "0.8.x" + "vows": "^0.8.3" }, "engines": { "node": ">= 4.0" From 3622dcbf6d7208586c36a9634fd96fa1e3cf8d95 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 3 Feb 2021 15:09:01 +0100 Subject: [PATCH 06/96] Bumps clean-css dependency to version 5.0. --- History.md | 5 +++++ README.md | 11 ++++++++++- index.js | 25 +++++++++++++------------ package-lock.json | 6 +++--- package.json | 2 +- test/binary-test.js | 10 +++++----- test/custom-cli/custom-cleancss | 17 +++++++++++++---- 7 files changed, 50 insertions(+), 26 deletions(-) diff --git a/History.md b/History.md index 67c01b6..be4cfce 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.0.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.3...HEAD) +================== + +* Bumps clean-css dependency to 5.0. + [4.3.0 / 2019-04-06](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.2...v4.3.0) ================== diff --git a/README.md b/README.md index f424375..11ca908 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0. - [Node.js version support](#nodejs-version-support) - [Install](#install) - [Use](#use) + * [What's new in version 5.0](#whats-new-in-version-50) * [Important: 4.0 breaking changes](#important-40-breaking-changes) * [What's new in version 4.1](#whats-new-in-version-41) * [What's new in version 4.2](#whats-new-in-version-42) @@ -59,6 +60,14 @@ Note: Global install via -g option is recommended unless you want to execute the cleancss -o one.min.css one.css ``` +## What's new in version 5.0 + +clean-css-cli 5.0 introduces the following changes / features: + +* clean-css 5.0 with loads of bugfixes; +* `--skip-rebase` option has been removed as rebasing URLs is disabled by default now +* `--with-rebase` option is added if you really want URLs rebasing + ## Important: 4.0 breaking changes clean-css-cli 4.0 introduces some breaking changes: @@ -227,7 +236,7 @@ or a fine-grained configuration given via a string. Please note that level 1 optimization options are generally safe while level 2 optimizations should be safe for most users. -Important: The `-O` option is using the capital letter O (as in "Oscar"), not the number zero. +Important: The `-O` option is using the capital letter O (as in "Oscar"), not the number zero. ### Level 0 optimizations diff --git a/index.js b/index.js index d68b3ba..f665219 100644 --- a/index.js +++ b/index.js @@ -32,7 +32,7 @@ function cli(process, beforeMinifyCallback) { .option('--inline [rules]', 'Enables inlining for listed sources (defaults to `local`)') .option('--inline-timeout [seconds]', 'Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)', parseFloat) .option('--remove-inlined-files', 'Remove files inlined in or via `@import` statements') - .option('--skip-rebase', 'Disable URLs rebasing') + .option('--with-rebase', 'Enable URLs rebasing') .option('--source-map', 'Enables building input\'s source map') .option('--source-map-inline-sources', 'Enables inlining sources inside source maps') .option('--input-source-map [file]', 'Specifies the path of the input source map file'); @@ -49,16 +49,17 @@ function cli(process, beforeMinifyCallback) { console.log(' %> cleancss --format keep-breaks one.css'); console.log(' %> cleancss --format \'indentBy:1;indentWith:tab\' one.css'); console.log(' %> cleancss --format \'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on\' one.css'); + console.log(' %> cleancss --format \'breaks:afterBlockBegins=2;spaces:aroundSelectorRelation=on\' one.css'); console.log(' %> # `breaks` controls where to insert breaks'); - console.log(' %> # `afterAtRule` controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `off` (alias to `false`)'); - console.log(' %> # `afterBlockBegins` controls if a line break comes after a block begins; e.g. `@media`; defaults to `off`'); - console.log(' %> # `afterBlockEnds` controls if a line break comes after a block ends, defaults to `off`'); - console.log(' %> # `afterComment` controls if a line break comes after a comment; defaults to `off`'); - console.log(' %> # `afterProperty` controls if a line break comes after a property; defaults to `off`'); - console.log(' %> # `afterRuleBegins` controls if a line break comes after a rule begins; defaults to `off`'); - console.log(' %> # `afterRuleEnds` controls if a line break comes after a rule ends; defaults to `off`'); - console.log(' %> # `beforeBlockEnds` controls if a line break comes before a block ends; defaults to `off`'); - console.log(' %> # `betweenSelectors` controls if a line break comes between selectors; defaults to `off`'); + console.log(' %> # `afterAtRule` controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `off` (alias to `false`); accepts number of line breaks as an argument too'); + console.log(' %> # `afterBlockBegins` controls if a line break comes after a block begins; e.g. `@media`; defaults to `off`; accepts number of line breaks as an argument too'); + console.log(' %> # `afterBlockEnds` controls if a line break comes after a block ends, defaults to `off`; accepts number of line breaks as an argument too'); + console.log(' %> # `afterComment` controls if a line break comes after a comment; defaults to `off`; accepts number of line breaks as an argument too'); + console.log(' %> # `afterProperty` controls if a line break comes after a property; defaults to `off`; accepts number of line breaks as an argument too'); + console.log(' %> # `afterRuleBegins` controls if a line break comes after a rule begins; defaults to `off`; accepts number of line breaks as an argument too'); + console.log(' %> # `afterRuleEnds` controls if a line break comes after a rule ends; defaults to `off`; accepts number of line breaks as an argument too'); + console.log(' %> # `beforeBlockEnds` controls if a line break comes before a block ends; defaults to `off`; accepts number of line breaks as an argument too'); + console.log(' %> # `betweenSelectors` controls if a line break comes between selectors; defaults to `off`; accepts number of line breaks as an argument too'); console.log(' %> # `indentBy` controls number of characters to indent with; defaults to `0`'); console.log(' %> # `indentWith` controls a character to indent with, can be `space` or `tab`; defaults to `space`'); console.log(' %> # `spaces` controls where to insert spaces'); @@ -153,8 +154,8 @@ function cli(process, beforeMinifyCallback) { { '0': commands.O0, '1': commands.O1, '2': commands.O2 } : undefined, output: commands.output, - rebase: commands.skipRebase ? false : true, - rebaseTo: ('output' in commands) && commands.output.length > 0 ? path.dirname(path.resolve(commands.output)) : process.cwd(), + rebase: commands.withRebase ? true : false, + rebaseTo: ('output' in commands) && commands.output.length > 0 ? path.dirname(path.resolve(commands.output)) : (commands.withRebase ? process.cwd() : undefined), sourceMap: commands.sourceMap, sourceMapInlineSources: commands.sourceMapInlineSources }; diff --git a/package-lock.json b/package-lock.json index d0fe8ed..78b31a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.3.tgz", - "integrity": "sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.0.1.tgz", + "integrity": "sha512-F1zAGOowUCg8yxT0O4UR+nmbMauf3YwbiUS60CPxpzJU7ulpamGzQomFrJSK4w/HqHtMmQKSHJUNue+dQQYQdg==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 1ac8d3e..55a9976 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ ], "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", "dependencies": { - "clean-css": "^4.2.1", + "clean-css": "^5.0.1", "commander": "^2.20.3", "glob": "^7.1.6" }, diff --git a/test/binary-test.js b/test/binary-test.js index bdcf10e..ecf4689 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -236,7 +236,7 @@ vows.describe('cleancss') 'relative image paths': { 'no output': binaryContext('./test/fixtures/partials-relative/base.css', { 'should leave paths': function (error, stdout) { - assert.equal(stdout, 'a{background:url(test/fixtures/partials/extra/down.gif) 0 0 no-repeat}'); + assert.equal(stdout, 'a{background:url(../partials/extra/down.gif) 0 0 no-repeat}'); } }), 'output': binaryContext('-o ./base1-min.css ./test/fixtures/partials-relative/base.css', { @@ -269,14 +269,14 @@ vows.describe('cleancss') }) .addBatch({ 'complex import and url rebasing': { - 'absolute': binaryContext('./test/fixtures/rebasing/assets/ui.css', { + 'absolute': binaryContext('--with-rebase ./test/fixtures/rebasing/assets/ui.css', { 'should rebase urls correctly': function (error, stdout) { assert.include(stdout, 'url(test/fixtures/rebasing/components/bootstrap/images/glyphs.gif)'); assert.include(stdout, 'url(test/fixtures/rebasing/components/jquery-ui/images/prev.gif)'); assert.include(stdout, 'url(test/fixtures/rebasing/components/jquery-ui/images/next.gif)'); } }), - 'relative': binaryContext('-o test/ui.bundled.css ./test/fixtures/rebasing/assets/ui.css', { + 'relative': binaryContext('--with-rebasing -o test/ui.bundled.css ./test/fixtures/rebasing/assets/ui.css', { 'should rebase urls correctly': function () { var minimized = fs.readFileSync('test/ui.bundled.css', 'utf-8'); assert.include(minimized, 'url(fixtures/rebasing/components/bootstrap/images/glyphs.gif)'); @@ -291,7 +291,7 @@ vows.describe('cleancss') }) .addBatch({ 'complex import and skipped url rebasing': { - 'absolute': binaryContext('--skip-rebase ./test/fixtures/rebasing/assets/ui.css', { + 'absolute': binaryContext('./test/fixtures/rebasing/assets/ui.css', { 'should rebase urls correctly': function (error, stdout) { assert.isNull(error); assert.include(stdout, 'url(../images/glyphs.gif)'); @@ -416,7 +416,7 @@ vows.describe('cleancss') }), 'custom': pipedContext('div{width:0.00051px}', '-O1 roundingPrecision:4', { 'should keep 4 decimal places': function (error, stdout) { - assert.equal(stdout, 'div{width:.0005px}'); + assert.equal(stdout, 'div{width:0.0005px}'); } }), 'zero': pipedContext('div{width:1.5051px}', '-O1 roundingPrecision:0', { diff --git a/test/custom-cli/custom-cleancss b/test/custom-cli/custom-cleancss index 106a455..3de31ef 100755 --- a/test/custom-cli/custom-cleancss +++ b/test/custom-cli/custom-cleancss @@ -1,10 +1,19 @@ #!/usr/bin/env node var cleanCssCli = require('../../index'); -return cleanCssCli(process, function (cleanCss) { - cleanCss.options.level['1'].transform = function (propertyName, propertyValue) { - if (propertyName == 'background-image' && propertyValue.indexOf('../valid/path/to') == -1) { - return propertyValue.replace('url(', 'url(../valid/path/to/'); + +var customPlugin = { + level1: { + value: function (propertyName, propertyValue, options) { + if (propertyName == 'background-image' && propertyValue.indexOf('../valid/path/to') == -1) { + return propertyValue.replace('url(', 'url(../valid/path/to/'); + } else { + return propertyValue; + } } } +} + +return cleanCssCli(process, function (cleanCss) { + cleanCss.options.plugins.level1Value.push(customPlugin.level1.value); }); From e39d95bc6b261625282cd1715556eeba3e82ee0e Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 4 Feb 2021 18:06:45 +0100 Subject: [PATCH 07/96] Bumps commander dependency to version 7.0. --- History.md | 1 + index.js | 74 ++++++++++++++++++++++----------------------- package-lock.json | 6 ++-- package.json | 2 +- test/binary-test.js | 2 +- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/History.md b/History.md index be4cfce..400c3fb 100644 --- a/History.md +++ b/History.md @@ -2,6 +2,7 @@ ================== * Bumps clean-css dependency to 5.0. +* Bumps commander dependency to 7.0. [4.3.0 / 2019-04-06](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.2...v4.3.0) ================== diff --git a/index.js b/index.js index f665219..ad54cb9 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ var fs = require('fs'); var path = require('path'); var CleanCSS = require('clean-css'); -var commands = require('commander'); +var program = require('commander'); var glob = require('glob'); var COMPATIBILITY_PATTERN = /([\w\.]+)=(\w+)/g; @@ -14,6 +14,7 @@ function cli(process, beforeMinifyCallback) { var fromStdin; var debugMode; var removeInlinedFiles; + var inputOptions; var options; var stdin; var data; @@ -21,7 +22,7 @@ function cli(process, beforeMinifyCallback) { beforeMinifyCallback = beforeMinifyCallback || Function.prototype; // Specify commander options to parse command line params correctly - commands + program .version(buildVersion, '-v, --version') .usage('[options] ') .option('-c, --compatibility [ie7|ie8]', 'Force compatibility mode (see Readme for advanced examples)') @@ -37,7 +38,7 @@ function cli(process, beforeMinifyCallback) { .option('--source-map-inline-sources', 'Enables inlining sources inside source maps') .option('--input-source-map [file]', 'Specifies the path of the input source map file'); - commands.on('--help', function () { + program.on('--help', function () { console.log(' Examples:\n'); console.log(' %> cleancss one.css'); console.log(' %> cleancss -o one-min.css one.css'); @@ -118,49 +119,48 @@ function cli(process, beforeMinifyCallback) { process.exit(); }); - commands.parse(process.argv); - - if (commands.rawArgs.indexOf('-O0') > -1) { - commands.O0 = true; - } - - if (commands.rawArgs.indexOf('-O1') > -1) { - commands.O1 = findArgumentTo('-O1', commands.rawArgs, commands.args); - } - - if (commands.rawArgs.indexOf('-O2') > -1) { - commands.O2 = findArgumentTo('-O2', commands.rawArgs, commands.args); - } + program.parse(process.argv); + inputOptions = program.opts(); // If no sensible data passed in just print help and exit - if (commands.args.length === 0) { + if (program.args.length === 0) { fromStdin = !process.env.__DIRECT__ && !process.stdin.isTTY; if (!fromStdin) { - commands.outputHelp(); + program.outputHelp(); return 0; } } - // Now coerce commands into CleanCSS configuration... - debugMode = commands.debug; - removeInlinedFiles = commands.removeInlinedFiles; + // Now coerce arguments into CleanCSS configuration... + debugMode = inputOptions.debug; + removeInlinedFiles = inputOptions.removeInlinedFiles; options = { - compatibility: commands.compatibility, - format: commands.format, - inline: typeof commands.inline == 'string' ? commands.inline : 'local', - inlineTimeout: commands.inlineTimeout * 1000, - level: commands.O0 || commands.O1 || commands.O2 ? - { '0': commands.O0, '1': commands.O1, '2': commands.O2 } : - undefined, - output: commands.output, - rebase: commands.withRebase ? true : false, - rebaseTo: ('output' in commands) && commands.output.length > 0 ? path.dirname(path.resolve(commands.output)) : (commands.withRebase ? process.cwd() : undefined), - sourceMap: commands.sourceMap, - sourceMapInlineSources: commands.sourceMapInlineSources + compatibility: inputOptions.compatibility, + format: inputOptions.format, + inline: typeof inputOptions.inline == 'string' ? inputOptions.inline : 'local', + inlineTimeout: inputOptions.inlineTimeout * 1000, + level: { 1: true }, + output: inputOptions.output, + rebase: inputOptions.withRebase ? true : false, + rebaseTo: ('output' in inputOptions) && inputOptions.output.length > 0 ? path.dirname(path.resolve(inputOptions.output)) : (inputOptions.withRebase ? process.cwd() : undefined), + sourceMap: inputOptions.sourceMap, + sourceMapInlineSources: inputOptions.sourceMapInlineSources }; - if (commands.inputSourceMap && !options.sourceMap) { + if (program.rawArgs.indexOf('-O0') > -1) { + options.level[0] = true; + } + + if (program.rawArgs.indexOf('-O1') > -1) { + options.level[1] = findArgumentTo('-O1', program.rawArgs, program.args); + } + + if (program.rawArgs.indexOf('-O2') > -1) { + options.level[2] = findArgumentTo('-O2', program.rawArgs, program.args); + } + + if (inputOptions.inputSourceMap && !options.sourceMap) { options.sourceMap = true; } @@ -173,12 +173,12 @@ function cli(process, beforeMinifyCallback) { beforeMinifyCallback: beforeMinifyCallback, debugMode: debugMode, removeInlinedFiles: removeInlinedFiles, - inputSourceMap: commands.inputSourceMap + inputSourceMap: inputOptions.inputSourceMap }; // ... and do the magic! - if (commands.args.length > 0) { - minify(process, options, configurations, expandGlobs(commands.args)); + if (program.args.length > 0) { + minify(process, options, configurations, expandGlobs(program.args)); } else { stdin = process.openStdin(); stdin.setEncoding('utf-8'); diff --git a/package-lock.json b/package-lock.json index 78b31a3..1e68580 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,9 +44,9 @@ } }, "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.0.0.tgz", + "integrity": "sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA==" }, "concat-map": { "version": "0.0.1", diff --git a/package.json b/package.json index 55a9976..1ab6cdd 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", "dependencies": { "clean-css": "^5.0.1", - "commander": "^2.20.3", + "commander": "7.x", "glob": "^7.1.6" }, "devDependencies": { diff --git a/test/binary-test.js b/test/binary-test.js index ecf4689..2c6fd1b 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -276,7 +276,7 @@ vows.describe('cleancss') assert.include(stdout, 'url(test/fixtures/rebasing/components/jquery-ui/images/next.gif)'); } }), - 'relative': binaryContext('--with-rebasing -o test/ui.bundled.css ./test/fixtures/rebasing/assets/ui.css', { + 'relative': binaryContext('--with-rebase -o test/ui.bundled.css ./test/fixtures/rebasing/assets/ui.css', { 'should rebase urls correctly': function () { var minimized = fs.readFileSync('test/ui.bundled.css', 'utf-8'); assert.include(minimized, 'url(fixtures/rebasing/components/bootstrap/images/glyphs.gif)'); From 6735a1a314a2a848107f07e32e245cb99173fca1 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 4 Feb 2021 18:09:54 +0100 Subject: [PATCH 08/96] Bumps version to 5.0.0-pre. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1ab6cdd..5abd81e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "4.3.0", + "version": "5.0.0-pre", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 7a6657f2336b01f0991e50829935c9a229ca640c Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 4 Feb 2021 18:11:37 +0100 Subject: [PATCH 09/96] Drops official support for Node.js < 10. --- .travis.yml | 3 +-- README.md | 3 ++- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 27ae770..a2fd976 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: node_js cache: npm node_js: - - 6 - - 8 - 10 - 12 + - 14 matrix: fast_finish: true diff --git a/README.md b/README.md index 11ca908..e8bb671 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0. # Node.js version support -clean-css-cli requires Node.js 4.0+ (tested on Linux, OS X, and Windows) +clean-css-cli requires Node.js 10.0+ (tested on Linux, OS X, and Windows) # Install @@ -65,6 +65,7 @@ cleancss -o one.min.css one.css clean-css-cli 5.0 introduces the following changes / features: * clean-css 5.0 with loads of bugfixes; +* drops official support for Node.js 4, 6, and 8; * `--skip-rebase` option has been removed as rebasing URLs is disabled by default now * `--with-rebase` option is added if you really want URLs rebasing diff --git a/package.json b/package.json index 5abd81e..0a8ace5 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,6 @@ "vows": "^0.8.3" }, "engines": { - "node": ">= 4.0" + "node": ">= 10.0" } } From 4e955740d6ec07f1885d588f4cc2fc514aea961b Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 4 Feb 2021 18:17:02 +0100 Subject: [PATCH 10/96] Updates package.lock after version bump. --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 1e68580..d58ddf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "4.3.0", + "version": "5.0.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": { From 9fc6e5ed43b8331c3e8141fc6d844fed2b4777a3 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 12:30:13 +0100 Subject: [PATCH 11/96] Fixes #18 - allows batch processing of input files via `--batch` option. --- History.md | 1 + README.md | 2 + index.js | 89 ++++++++++++++++++++++++++++----------------- test/binary-test.js | 40 +++++++++++++++++++- 4 files changed, 98 insertions(+), 34 deletions(-) diff --git a/History.md b/History.md index 400c3fb..cba3bd2 100644 --- a/History.md +++ b/History.md @@ -3,6 +3,7 @@ * Bumps clean-css dependency to 5.0. * Bumps commander dependency to 7.0. +* Fixed issue [#18](https://github.com/jakubpawlowicz/clean-css-cli/issues/18) - allows batch processing of input files. [4.3.0 / 2019-04-06](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.2...v4.3.0) ================== diff --git a/README.md b/README.md index e8bb671..9773ae7 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ cleancss -o one.min.css one.css clean-css-cli 5.0 introduces the following changes / features: +* adds `--batch` option (off by default) which processes input files one by one without joining them together; * clean-css 5.0 with loads of bugfixes; * drops official support for Node.js 4, 6, and 8; * `--skip-rebase` option has been removed as rebasing URLs is disabled by default now @@ -115,6 +116,7 @@ clean-css-cli 4.3 introduces the following changes / features: ```shell -h, --help output usage information -v, --version output the version number +-b, --batch If enabled, optimizes input files one by one instead of joining them together -c, --compatibility [ie7|ie8] Force compatibility mode (see Readme for advanced examples) -d, --debug Shows debug information (minification time & compression efficiency) -f, --format Controls output formatting, see examples below diff --git a/index.js b/index.js index ad54cb9..05cc04f 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,7 @@ function cli(process, beforeMinifyCallback) { program .version(buildVersion, '-v, --version') .usage('[options] ') + .option('-b, --batch', 'If enabled, optimizes input files one by one instead of joining them together') .option('-c, --compatibility [ie7|ie8]', 'Force compatibility mode (see Readme for advanced examples)') .option('-d, --debug', 'Shows debug information (minification time & compression efficiency)') .option('-f, --format ', 'Controls output formatting, see examples below') @@ -136,6 +137,7 @@ function cli(process, beforeMinifyCallback) { removeInlinedFiles = inputOptions.removeInlinedFiles; options = { + batch: inputOptions.batch, compatibility: inputOptions.compatibility, format: inputOptions.format, inline: typeof inputOptions.inline == 'string' ? inputOptions.inline : 'local', @@ -232,41 +234,63 @@ function minify(process, options, configurations, data) { applyNonBooleanCompatibilityFlags(cleanCss, options.compatibility); configurations.beforeMinifyCallback(cleanCss); cleanCss.minify(data, getSourceMapContent(configurations.inputSourceMap), function (errors, minified) { - var mapFilename; - - if (configurations.debugMode) { - console.error('Original: %d bytes', minified.stats.originalSize); - console.error('Minified: %d bytes', minified.stats.minifiedSize); - console.error('Efficiency: %d%', ~~(minified.stats.efficiency * 10000) / 100.0); - console.error('Time spent: %dms', minified.stats.timeSpent); - - if (minified.inlinedStylesheets.length > 0) { - console.error('Inlined stylesheets:'); - minified.inlinedStylesheets.forEach(function (uri) { - console.error('- %s', uri); - }); + var inputPath; + + if (options.batch && !('styles' in minified)) { + for (inputPath in minified) { + processMinified(process, configurations, minified[inputPath], inputPath, toOutputPath(inputPath)); } + } else { + processMinified(process, configurations, minified, null, options.output); } + }); +} + +function toOutputPath(inputPath) { + return inputPath.replace(/\.css$/, '-min.css'); +} - outputFeedback(minified.errors, true); - outputFeedback(minified.warnings); +function processMinified(process, configurations, minified, inputPath, outputPath) { + var mapOutputPath; - if (minified.errors.length > 0) { - process.exit(1); + if (configurations.debugMode) { + if (inputPath) { + console.error('File: %s', inputPath); } - if (configurations.removeInlinedFiles) { - minified.inlinedStylesheets.forEach(fs.unlinkSync); - } + console.error('Original: %d bytes', minified.stats.originalSize); + console.error('Minified: %d bytes', minified.stats.minifiedSize); + console.error('Efficiency: %d%', ~~(minified.stats.efficiency * 10000) / 100.0); + console.error('Time spent: %dms', minified.stats.timeSpent); - if (minified.sourceMap) { - mapFilename = path.basename(options.output) + '.map'; - output(process, options, minified.styles + lineBreak + '/*# sourceMappingURL=' + mapFilename + ' */'); - outputMap(options, minified.sourceMap, mapFilename); - } else { - output(process, options, minified.styles); + if (minified.inlinedStylesheets.length > 0) { + console.error('Inlined stylesheets:'); + minified.inlinedStylesheets.forEach(function (uri) { + console.error('- %s', uri); + }); } - }); + + console.error(''); + } + + outputFeedback(minified.errors, true); + outputFeedback(minified.warnings); + + if (minified.errors.length > 0) { + process.exit(1); + } + + if (configurations.removeInlinedFiles) { + minified.inlinedStylesheets.forEach(fs.unlinkSync); + } + + if (minified.sourceMap) { + mapOutputPath = outputPath + '.map'; + output(process, outputPath, minified.styles + lineBreak + '/*# sourceMappingURL=' + path.basename(mapOutputPath) + ' */'); + outputMap(mapOutputPath, minified.sourceMap); + } else { + output(process, outputPath, minified.styles); + } } function applyNonBooleanCompatibilityFlags(cleanCss, compatibility) { @@ -319,17 +343,16 @@ function getSourceMapContent(sourceMapPath) { return content; } -function output(process, options, minified) { - if (options.output) { - fs.writeFileSync(options.output, minified, 'utf8'); +function output(process, outputPath, minified) { + if (outputPath) { + fs.writeFileSync(outputPath, minified, 'utf8'); } else { process.stdout.write(minified); } } -function outputMap(options, sourceMap, mapFilename) { - var mapPath = path.join(path.dirname(options.output), mapFilename); - fs.writeFileSync(mapPath, sourceMap.toString(), 'utf-8'); +function outputMap(mapOutputPath, sourceMap) { + fs.writeFileSync(mapOutputPath, sourceMap.toString(), 'utf-8'); } module.exports = cli; diff --git a/test/binary-test.js b/test/binary-test.js index 2c6fd1b..df7b2e5 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -719,7 +719,7 @@ vows.describe('cleancss') }) .addBatch({ 'content of input-source-map': pipedContext(fs.readFileSync('./test/fixtures/source-maps/map/styles.css'), '-o ./test/styles.min.css --input-source-map ./test/fixtures/source-maps/map/input.map', { - 'includes the right content of the source map': function() { + 'processes content normally': function() { assert.isTrue(fs.existsSync('test/styles.min.css.map')); var sourceMap = new SourceMapConsumer(fs.readFileSync('./test/styles.min.css.map', 'utf-8')); @@ -739,4 +739,42 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'batch processing in piped mode': pipedContext(fs.readFileSync('./test/fixtures/partials/one.css'), '-b', { + 'includes the right content of the source map': function (error, stdout) { + assert.equal(stdout, '.one{color:red}'); + } + }), + 'batch processing with explicitely given paths': binaryContext('-b ./test/fixtures/partials/one.css ./test/fixtures/partials/five.css', { + 'creates two separate minified files': function () { + assert.isTrue(fs.existsSync('test/fixtures/partials/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures/partials/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/five-min.css')); + }, + 'teardown': function () { + deleteFile('test/fixtures/partials/one-min.css'); + deleteFile('test/fixtures/partials/five-min.css'); + } + }) + }) + .addBatch({ + 'batch processing with wildard paths': binaryContext('-b ./test/fixtures/partials/\\*\\*/*.css', { + 'creates two separate minified files': function () { + assert.isTrue(fs.existsSync('test/fixtures/partials/extra/four-min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/extra/three-min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/one-min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/quoted-svg-min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/five-min.css')); + }, + 'teardown': function () { + deleteFile('test/fixtures/partials/extra/four-min.css'); + deleteFile('test/fixtures/partials/extra/three-min.css'); + deleteFile('test/fixtures/partials/one-min.css'); + deleteFile('test/fixtures/partials/two-min.css'); + deleteFile('test/fixtures/partials/quoted-svg-min.css'); + deleteFile('test/fixtures/partials/five-min.css'); + } + }) + }) .export(module); From 50854f9530cebb413ad0e90e6907b255e064fe20 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 13:02:12 +0100 Subject: [PATCH 12/96] Adds `--batch-suffix` option. It specifies what gets added to output filename when processing in batch mode. --- History.md | 1 + README.md | 1 + index.js | 10 +++++++--- test/binary-test.js | 17 +++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index cba3bd2..fc5eb80 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,7 @@ [5.0.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.3...HEAD) ================== +* Adds `--batch-suffix` option to specify what gets appended to output filename in batch mode. * Bumps clean-css dependency to 5.0. * Bumps commander dependency to 7.0. * Fixed issue [#18](https://github.com/jakubpawlowicz/clean-css-cli/issues/18) - allows batch processing of input files. diff --git a/README.md b/README.md index 9773ae7..00f945c 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ cleancss -o one.min.css one.css clean-css-cli 5.0 introduces the following changes / features: * adds `--batch` option (off by default) which processes input files one by one without joining them together; +* adds `--batch-suffix` option to specify what gets appended to output filename in batch mode; * clean-css 5.0 with loads of bugfixes; * drops official support for Node.js 4, 6, and 8; * `--skip-rebase` option has been removed as rebasing URLs is disabled by default now diff --git a/index.js b/index.js index 05cc04f..d42f8ac 100644 --- a/index.js +++ b/index.js @@ -31,6 +31,7 @@ function cli(process, beforeMinifyCallback) { .option('-f, --format ', 'Controls output formatting, see examples below') .option('-o, --output [output-file]', 'Use [output-file] as output instead of STDOUT') .option('-O [optimizations]', 'Turn on level optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below, IMPORTANT: the prefix is O (a capital o letter), NOT a 0 (zero, a number)', function (val) { return Math.abs(parseInt(val)); }) + .option('--batch-suffix ', 'A suffix (without extension) appended to input file name when processing in batch mode (`-min` is the default)', '-min') .option('--inline [rules]', 'Enables inlining for listed sources (defaults to `local`)') .option('--inline-timeout [seconds]', 'Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)', parseFloat) .option('--remove-inlined-files', 'Remove files inlined in or via `@import` statements') @@ -172,6 +173,7 @@ function cli(process, beforeMinifyCallback) { } var configurations = { + batchSuffix: inputOptions.batchSuffix, beforeMinifyCallback: beforeMinifyCallback, debugMode: debugMode, removeInlinedFiles: removeInlinedFiles, @@ -238,7 +240,7 @@ function minify(process, options, configurations, data) { if (options.batch && !('styles' in minified)) { for (inputPath in minified) { - processMinified(process, configurations, minified[inputPath], inputPath, toOutputPath(inputPath)); + processMinified(process, configurations, minified[inputPath], inputPath, toOutputPath(inputPath, configurations.batchSuffix)); } } else { processMinified(process, configurations, minified, null, options.output); @@ -246,8 +248,10 @@ function minify(process, options, configurations, data) { }); } -function toOutputPath(inputPath) { - return inputPath.replace(/\.css$/, '-min.css'); +function toOutputPath(inputPath, batchSuffix) { + var extensionName = path.extname(inputPath); + + return inputPath.replace(new RegExp(extensionName + '$'), batchSuffix + extensionName); } function processMinified(process, configurations, minified, inputPath, outputPath) { diff --git a/test/binary-test.js b/test/binary-test.js index df7b2e5..004ae88 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -777,4 +777,21 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'batch processing with custom suffix': binaryContext('--batch --batch-suffix \'.min\' ./test/fixtures/partials/one.css ./test/fixtures/partials/five.css', { + 'creates two separate minified files': function () { + assert.isFalse(fs.existsSync('test/fixtures/partials/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures/partials/two-min.css')); + assert.isFalse(fs.existsSync('test/fixtures/partials/five-min.css')); + + assert.isTrue(fs.existsSync('test/fixtures/partials/one.min.css')); + assert.isFalse(fs.existsSync('test/fixtures/partials/two.min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/five.min.css')); + }, + 'teardown': function () { + deleteFile('test/fixtures/partials/one.min.css'); + deleteFile('test/fixtures/partials/five.min.css'); + } + }) + }) .export(module); From a25a5f859edee3ef2f9280e6471d8d284dff7401 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 13:35:33 +0100 Subject: [PATCH 13/96] Fixes #36 - automatically creates missing output directories. --- History.md | 1 + README.md | 1 + index.js | 1 + test/binary-test.js | 9 +++++++++ 4 files changed, 12 insertions(+) diff --git a/History.md b/History.md index fc5eb80..bc1ccc9 100644 --- a/History.md +++ b/History.md @@ -5,6 +5,7 @@ * Bumps clean-css dependency to 5.0. * Bumps commander dependency to 7.0. * Fixed issue [#18](https://github.com/jakubpawlowicz/clean-css-cli/issues/18) - allows batch processing of input files. +* Fixed issue [#36](https://github.com/jakubpawlowicz/clean-css-cli/issues/36) - automatically creates missing output directories. [4.3.0 / 2019-04-06](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.2...v4.3.0) ================== diff --git a/README.md b/README.md index 00f945c..3f4e111 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ clean-css-cli 5.0 introduces the following changes / features: * adds `--batch` option (off by default) which processes input files one by one without joining them together; * adds `--batch-suffix` option to specify what gets appended to output filename in batch mode; +* automatically creates missing output directories; * clean-css 5.0 with loads of bugfixes; * drops official support for Node.js 4, 6, and 8; * `--skip-rebase` option has been removed as rebasing URLs is disabled by default now diff --git a/index.js b/index.js index d42f8ac..155caea 100644 --- a/index.js +++ b/index.js @@ -349,6 +349,7 @@ function getSourceMapContent(sourceMapPath) { function output(process, outputPath, minified) { if (outputPath) { + fs.mkdirSync(path.dirname(outputPath), {recursive: true}); fs.writeFileSync(outputPath, minified, 'utf8'); } else { process.stdout.write(minified); diff --git a/test/binary-test.js b/test/binary-test.js index 004ae88..9c5b04c 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -196,6 +196,15 @@ vows.describe('cleancss') teardown: function () { deleteFile('./reset1-min.css'); } + }), + 'to file when target path does not exist': binaryContext('-o ./test/fixtures-temp/reset-min.css ./test/fixtures/reset.css', { + 'should create a directory and optimized file': function () { + assert.isTrue(fs.existsSync('test/fixtures-temp')); + assert.isTrue(fs.existsSync('test/fixtures-temp/reset-min.css')); + }, + teardown: function () { + exec('rm -rf test/fixtures-temp'); + } }) }) .addBatch({ From 056208b4e2d62134c6af5f82c6399c8edf0c393d Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 13:53:08 +0100 Subject: [PATCH 14/96] Cleans up source code by removing extra variables. --- index.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 155caea..c7d7dd9 100644 --- a/index.js +++ b/index.js @@ -12,8 +12,6 @@ function cli(process, beforeMinifyCallback) { var packageConfig = fs.readFileSync(path.join(__dirname, 'package.json')); var buildVersion = JSON.parse(packageConfig).version; var fromStdin; - var debugMode; - var removeInlinedFiles; var inputOptions; var options; var stdin; @@ -134,9 +132,6 @@ function cli(process, beforeMinifyCallback) { } // Now coerce arguments into CleanCSS configuration... - debugMode = inputOptions.debug; - removeInlinedFiles = inputOptions.removeInlinedFiles; - options = { batch: inputOptions.batch, compatibility: inputOptions.compatibility, @@ -175,8 +170,8 @@ function cli(process, beforeMinifyCallback) { var configurations = { batchSuffix: inputOptions.batchSuffix, beforeMinifyCallback: beforeMinifyCallback, - debugMode: debugMode, - removeInlinedFiles: removeInlinedFiles, + debugMode: inputOptions.debug, + removeInlinedFiles: inputOptions.removeInlinedFiles, inputSourceMap: inputOptions.inputSourceMap }; From 29c0561fb5d4dbb2e75f4ba116d2f4ebd07d8c24 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 13:58:28 +0100 Subject: [PATCH 15/96] Cleans up CLI help but leaves all examples in README.md. --- README.md | 8 ++--- index.js | 101 ++++++++++++++---------------------------------------- 2 files changed, 30 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 3f4e111..34f9f37 100644 --- a/README.md +++ b/README.md @@ -116,21 +116,21 @@ clean-css-cli 4.3 introduces the following changes / features: ## CLI options ```shell --h, --help output usage information --v, --version output the version number -b, --batch If enabled, optimizes input files one by one instead of joining them together -c, --compatibility [ie7|ie8] Force compatibility mode (see Readme for advanced examples) -d, --debug Shows debug information (minification time & compression efficiency) -f, --format Controls output formatting, see examples below +-h, --help output usage information -o, --output [output-file] Use [output-file] as output instead of STDOUT -O [optimizations] Turn on level optimizations; optionally accepts a list of fine-grained options, defaults to `1`, IMPORTANT: the prefix is O (a capital o letter), NOT a 0 (zero, a number) +-v, --version output the version number --inline [rules] Enables inlining for listed sources (defaults to `local`) --inline-timeout [seconds] Per connection timeout when fetching remote stylesheets (defaults to 5 seconds) +--input-source-map [file] Specifies the path of the input source map file --remove-inlined-files Remove files inlined in or via `@import` statements ---skip-rebase Disable URLs rebasing --source-map Enables building input's source map --source-map-inline-sources Enables inlining sources inside source maps ---input-source-map [file] Specifies the path of the input source map file +--with-rebase Disable URLs rebasing ``` ## Compatibility modes diff --git a/index.js b/index.js index c7d7dd9..f69d15b 100644 --- a/index.js +++ b/index.js @@ -21,100 +21,51 @@ function cli(process, beforeMinifyCallback) { // Specify commander options to parse command line params correctly program - .version(buildVersion, '-v, --version') .usage('[options] ') .option('-b, --batch', 'If enabled, optimizes input files one by one instead of joining them together') .option('-c, --compatibility [ie7|ie8]', 'Force compatibility mode (see Readme for advanced examples)') .option('-d, --debug', 'Shows debug information (minification time & compression efficiency)') .option('-f, --format ', 'Controls output formatting, see examples below') + .option('-h, --help', 'display this help') .option('-o, --output [output-file]', 'Use [output-file] as output instead of STDOUT') .option('-O [optimizations]', 'Turn on level optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below, IMPORTANT: the prefix is O (a capital o letter), NOT a 0 (zero, a number)', function (val) { return Math.abs(parseInt(val)); }) + .version(buildVersion, '-v, --version') .option('--batch-suffix ', 'A suffix (without extension) appended to input file name when processing in batch mode (`-min` is the default)', '-min') .option('--inline [rules]', 'Enables inlining for listed sources (defaults to `local`)') .option('--inline-timeout [seconds]', 'Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)', parseFloat) + .option('--input-source-map [file]', 'Specifies the path of the input source map file') .option('--remove-inlined-files', 'Remove files inlined in or via `@import` statements') - .option('--with-rebase', 'Enable URLs rebasing') .option('--source-map', 'Enables building input\'s source map') .option('--source-map-inline-sources', 'Enables inlining sources inside source maps') - .option('--input-source-map [file]', 'Specifies the path of the input source map file'); + .option('--with-rebase', 'Enable URLs rebasing'); program.on('--help', function () { - console.log(' Examples:\n'); - console.log(' %> cleancss one.css'); - console.log(' %> cleancss -o one-min.css one.css'); - console.log(' %> cleancss -o merged-and-minified.css one.css two.css three.css'); - console.log(' %> cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz'); console.log(''); - console.log(' Formatting options:'); - console.log(' %> cleancss --format beautify one.css'); - console.log(' %> cleancss --format keep-breaks one.css'); - console.log(' %> cleancss --format \'indentBy:1;indentWith:tab\' one.css'); - console.log(' %> cleancss --format \'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on\' one.css'); - console.log(' %> cleancss --format \'breaks:afterBlockBegins=2;spaces:aroundSelectorRelation=on\' one.css'); - console.log(' %> # `breaks` controls where to insert breaks'); - console.log(' %> # `afterAtRule` controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `off` (alias to `false`); accepts number of line breaks as an argument too'); - console.log(' %> # `afterBlockBegins` controls if a line break comes after a block begins; e.g. `@media`; defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `afterBlockEnds` controls if a line break comes after a block ends, defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `afterComment` controls if a line break comes after a comment; defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `afterProperty` controls if a line break comes after a property; defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `afterRuleBegins` controls if a line break comes after a rule begins; defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `afterRuleEnds` controls if a line break comes after a rule ends; defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `beforeBlockEnds` controls if a line break comes before a block ends; defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `betweenSelectors` controls if a line break comes between selectors; defaults to `off`; accepts number of line breaks as an argument too'); - console.log(' %> # `indentBy` controls number of characters to indent with; defaults to `0`'); - console.log(' %> # `indentWith` controls a character to indent with, can be `space` or `tab`; defaults to `space`'); - console.log(' %> # `spaces` controls where to insert spaces'); - console.log(' %> # `aroundSelectorRelation` controls if spaces come around selector relations; e.g. `div > a`; defaults to `off`'); - console.log(' %> # `beforeBlockBegins` controls if a space comes before a block begins; e.g. `.block {`; defaults to `off`'); - console.log(' %> # `beforeValue` controls if a space comes before a value; e.g. `width: 1rem`; defaults to `off`'); - console.log(' %> # `wrapAt` controls maximum line length; defaults to `off`'); + console.log('Examples:\n'); + console.log(' %> cleancss one.css'); + console.log(' %> cleancss -o one-min.css one.css'); + console.log(' %> cleancss -o merged-and-minified.css one.css two.css three.css'); + console.log(' %> cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz'); + console.log(''); + console.log('Formatting options:'); + console.log(' %> cleancss --format beautify one.css'); + console.log(' %> cleancss --format keep-breaks one.css'); + console.log(' %> cleancss --format \'indentBy:1;indentWith:tab\' one.css'); + console.log(' %> cleancss --format \'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on\' one.css'); + console.log(' %> cleancss --format \'breaks:afterBlockBegins=2;spaces:aroundSelectorRelation=on\' one.css'); console.log(''); - console.log(' Level 0 optimizations:'); - console.log(' %> cleancss -O0 one.css'); + console.log('Level 0 optimizations:'); + console.log(' %> cleancss -O0 one.css'); console.log(''); - console.log(' Level 1 optimizations:'); - console.log(' %> cleancss -O1 one.css'); - console.log(' %> cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css'); - console.log(' %> cleancss -O1 all:off;specialComments:1 one.css'); - console.log(' %> # `cleanupCharsets` controls `@charset` moving to the front of a stylesheet; defaults to `on`'); - console.log(' %> # `normalizeUrls` controls URL normalzation; default to `on`'); - console.log(' %> # `optimizeBackground` controls `background` property optimizatons; defaults to `on`'); - console.log(' %> # `optimizeBorderRadius` controls `border-radius` property optimizatons; defaults to `on`'); - console.log(' %> # `optimizeFilter` controls `filter` property optimizatons; defaults to `on`'); - console.log(' %> # `optimizeFontWeight` controls `font-weight` property optimizatons; defaults to `on`'); - console.log(' %> # `optimizeOutline` controls `outline` property optimizatons; defaults to `on`'); - console.log(' %> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)'); - console.log(' %> # `removeNegativePaddings` controls removing negative paddings; defaults to `on`'); - console.log(' %> # `removeQuotes` controls removing quotes when unnecessary; defaults to `on`'); - console.log(' %> # `removeWhitespace` controls removing unused whitespace; defaults to `on`'); - console.log(' %> # `replaceMultipleZeros` contols removing redundant zeros; defaults to `on`'); - console.log(' %> # `replaceTimeUnits` controls replacing time units with shorter values; defaults to `on'); - console.log(' %> # `replaceZeroUnits` controls replacing zero values with units; defaults to `on`'); - console.log(' %> # `roundingPrecision` rounds pixel values to `N` decimal places; `off` disables rounding; defaults to `off`'); - console.log(' %> # `selectorsSortingMethod` denotes selector sorting method; can be `natural` or `standard`; defaults to `standard`'); - console.log(' %> # `specialComments` denotes a number of /*! ... */ comments preserved; defaults to `all`'); - console.log(' %> # `tidyAtRules` controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `on`'); - console.log(' %> # `tidyBlockScopes` controls block scopes (e.g. `@media`) optimizing; defaults to `on`'); - console.log(' %> # `tidySelectors` controls selectors optimizing; defaults to `on`'); + console.log('Level 1 optimizations:'); + console.log(' %> cleancss -O1 one.css'); + console.log(' %> cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css'); + console.log(' %> cleancss -O1 all:off;specialComments:1 one.css'); console.log(''); - console.log(' Level 2 optimizations:'); - console.log(' %> cleancss -O2 one.css'); - console.log(' %> cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;mergeIntoShorthands:off one.css'); - console.log(' %> cleancss -O2 all:off;removeDuplicateRules:on one.css'); - console.log(' %> # `mergeAdjacentRules` controls adjacent rules merging; defaults to `on`'); - console.log(' %> # `mergeIntoShorthands` controls merging properties into shorthands; defaults to `on`'); - console.log(' %> # `mergeMedia` controls `@media` merging; defaults to `on`'); - console.log(' %> # `mergeNonAdjacentRules` controls non-adjacent rule merging; defaults to `on`'); - console.log(' %> # `mergeSemantically` controls semantic merging; defaults to `off`'); - console.log(' %> # `overrideProperties` controls property overriding based on understandability; defaults to `on`'); - console.log(' %> # `reduceNonAdjacentRules` controls non-adjacent rule reducing; defaults to `on`'); - console.log(' %> # `removeDuplicateFontRules` controls duplicate `@font-face` removing; defaults to `on`'); - console.log(' %> # `removeDuplicateMediaBlocks` controls duplicate `@media` removing; defaults to `on`'); - console.log(' %> # `removeDuplicateRules` controls duplicate rules removing; defaults to `on`'); - console.log(' %> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)'); - console.log(' %> # `removeUnusedAtRules` controls unused at rule removing; defaults to `off` (since 4.1.0)'); - console.log(' %> # `restructureRules` controls rule restructuring; defaults to `off`'); - console.log(' %> # `skipProperties` controls which properties won\'t be optimized, defaults to empty list which means all will be optimized (since 4.1.0)'); + console.log('Level 2 optimizations:'); + console.log(' %> cleancss -O2 one.css'); + console.log(' %> cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;mergeIntoShorthands:off one.css'); + console.log(' %> cleancss -O2 all:off;removeDuplicateRules:on one.css'); process.exit(); }); From 24f2dd06a48f2445a57c235724d236a309f7edaf Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 13:59:28 +0100 Subject: [PATCH 16/96] Includes README.md in output package as it may be useful. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a8ace5..4427114 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "bin", "History.md", "index.js", - "LICENSE" + "LICENSE", + "README.md" ], "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", "dependencies": { From b1ffa29332b1e4d4cc856522b104ae22f3e97061 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 14:02:34 +0100 Subject: [PATCH 17/96] Adds default build workflow. --- .github/workflows/node.js.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..80c2bae --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,29 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: x86 Linux build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x, 15.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm test From c0f372b8402e7a86bc749703602d323ecf0cdcac Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 14:04:08 +0100 Subject: [PATCH 18/96] Adds GitHub Actions build badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34f9f37..cb08e6f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![NPM version](https://img.shields.io/npm/v/clean-css-cli.svg?style=flat)](https://www.npmjs.com/package/clean-css-cli) -[![Linux Build Status](https://img.shields.io/travis/jakubpawlowicz/clean-css-cli/master.svg?style=flat&label=Linux%20build)](https://travis-ci.org/jakubpawlowicz/clean-css) +![x86 Linux build](https://github.com/jakubpawlowicz/clean-css-cli/workflows/x86%20Linux%20build/badge.svg) [![Dependency Status](https://img.shields.io/david/jakubpawlowicz/clean-css-cli.svg?style=flat)](https://david-dm.org/jakubpawlowicz/clean-css-cli) [![NPM Downloads](https://img.shields.io/npm/dm/clean-css-cli.svg)](https://www.npmjs.com/package/clean-css-cli) [![Twitter](https://img.shields.io/badge/Twitter-@cleancss-blue.svg)](https://twitter.com/cleancss) From 6d241357df0bd7261786338cfc154762898bc48c Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 14:04:32 +0100 Subject: [PATCH 19/96] Removes Travis CI. --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a2fd976..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -cache: npm -node_js: - - 10 - - 12 - - 14 -matrix: - fast_finish: true From 4c17387faa67c33e989df3c04effce22c0706c5f Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 14:08:19 +0100 Subject: [PATCH 20/96] Removes link to Twitter profile as we won't be using it anymore. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index cb08e6f..4856622 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ ![x86 Linux build](https://github.com/jakubpawlowicz/clean-css-cli/workflows/x86%20Linux%20build/badge.svg) [![Dependency Status](https://img.shields.io/david/jakubpawlowicz/clean-css-cli.svg?style=flat)](https://david-dm.org/jakubpawlowicz/clean-css-cli) [![NPM Downloads](https://img.shields.io/npm/dm/clean-css-cli.svg)](https://www.npmjs.com/package/clean-css-cli) -[![Twitter](https://img.shields.io/badge/Twitter-@cleancss-blue.svg)](https://twitter.com/cleancss) clean-css-cli is a command-line interface to [clean-css](https://github.com/jakubpawlowicz/clean-css) - fast and efficient CSS optimizer for [Node.js](http://nodejs.org/). From 3ea1242bee7eed6396b1c97d3eb9b47c96f47c8f Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 14:24:49 +0100 Subject: [PATCH 21/96] Reorders version summaries in README. --- README.md | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 4856622..d2edabb 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,10 @@ Previously a part of clean-css it's a separate package since clean-css 4.0. - [Install](#install) - [Use](#use) * [What's new in version 5.0](#whats-new-in-version-50) - * [Important: 4.0 breaking changes](#important-40-breaking-changes) - * [What's new in version 4.1](#whats-new-in-version-41) - * [What's new in version 4.2](#whats-new-in-version-42) * [What's new in version 4.3](#whats-new-in-version-43) + * [What's new in version 4.2](#whats-new-in-version-42) + * [What's new in version 4.1](#whats-new-in-version-41) + * [What's new in version 4.0](#whats-new-in-version-40) * [CLI options](#cli-options) * [Compatibility modes](#compatibility-modes) * [Formatting options](#formatting-options) @@ -71,23 +71,17 @@ clean-css-cli 5.0 introduces the following changes / features: * `--skip-rebase` option has been removed as rebasing URLs is disabled by default now * `--with-rebase` option is added if you really want URLs rebasing -## Important: 4.0 breaking changes +## What's new in version 4.3 -clean-css-cli 4.0 introduces some breaking changes: +clean-css-cli 4.3 introduces the following changes / features: -* API and CLI interfaces are split, so CLI has been moved to this repository while API stays at [clean-css](https://github.com/jakubpawlowicz/clean-css); -* `--root` and `--relativeTo` options are replaced by a single option taken from `--output` path - this means that rebasing URLs and import inlining is much simpler but may not be (YMMV) as powerful as in 3.x; -* `--rounding-precision` is disabled by default; -* `--rounding-precision` applies to **all** units now, not only `px` as in 3.x; -* `--skip-import` and `--skip-import-from` are merged into `--inline` option which defaults to `local`. Remote `@import` rules are **NOT** inlined by default anymore; -* renames `--timeout` option to `--inline-timeout`; -* remote resources without a protocol, e.g. `//fonts.googleapis.com/css?family=Domine:700`, are not inlined anymore; -* changes default Internet Explorer compatibility from 9+ to 10+, to revert the old default use `--compatibility ie9` option; -* moves `--rounding-precision`, `--s0`, and `--s1` options to level 1 optimization options, see examples; -* moves `--skip-media-merging`, `--skip-restructuring`, `--semantic-merging`, and `--skip-shorthand-compacting` to level 2 optimizations options, see examples below; -* level 1 optimizations are the new default, up to 3.x it was level 2; -* `--keep-breaks` option is replaced with `--format keep-breaks` to ease transition; -* `--skip-aggressive-merging` option is removed as aggressive merging is replaced by smarter override merging. +* `--input-source-map` option which accepts a path to input source map file. + +## What's new in version 4.2 + +clean-css-cli 4.2 introduces the following changes / features: + +* [clean-css 4.2](https://github.com/jakubpawlowicz/clean-css#whats-new-in-version-42) as a dependency; ## What's new in version 4.1 @@ -100,17 +94,23 @@ clean-css-cli 4.1 introduces the following changes / features: * extracts CLI into an importable module, so it can be reused and enhanced if needed; * adds `beforeMinify` callback as a second argument to CLI module, see [example use case](#as-a-module). -## What's new in version 4.2 - -clean-css-cli 4.2 introduces the following changes / features: - -* [clean-css 4.2](https://github.com/jakubpawlowicz/clean-css#whats-new-in-version-42) as a dependency; +## What's new in version 4.0 -## What's new in version 4.3 - -clean-css-cli 4.3 introduces the following changes / features: +clean-css-cli 4.0 introduces some breaking changes: -* `--input-source-map` option which accepts a path to input source map file. +* API and CLI interfaces are split, so CLI has been moved to this repository while API stays at [clean-css](https://github.com/jakubpawlowicz/clean-css); +* `--root` and `--relativeTo` options are replaced by a single option taken from `--output` path - this means that rebasing URLs and import inlining is much simpler but may not be (YMMV) as powerful as in 3.x; +* `--rounding-precision` is disabled by default; +* `--rounding-precision` applies to **all** units now, not only `px` as in 3.x; +* `--skip-import` and `--skip-import-from` are merged into `--inline` option which defaults to `local`. Remote `@import` rules are **NOT** inlined by default anymore; +* renames `--timeout` option to `--inline-timeout`; +* remote resources without a protocol, e.g. `//fonts.googleapis.com/css?family=Domine:700`, are not inlined anymore; +* changes default Internet Explorer compatibility from 9+ to 10+, to revert the old default use `--compatibility ie9` option; +* moves `--rounding-precision`, `--s0`, and `--s1` options to level 1 optimization options, see examples; +* moves `--skip-media-merging`, `--skip-restructuring`, `--semantic-merging`, and `--skip-shorthand-compacting` to level 2 optimizations options, see examples below; +* level 1 optimizations are the new default, up to 3.x it was level 2; +* `--keep-breaks` option is replaced with `--format keep-breaks` to ease transition; +* `--skip-aggressive-merging` option is removed as aggressive merging is replaced by smarter override merging. ## CLI options From ff1be03a4ecf42fdbda8a15526559b5a58271d5d Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 14:26:19 +0100 Subject: [PATCH 22/96] Updates info on clean-css-cli v5 not doing rebasing by default. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2edabb..14f03b2 100644 --- a/README.md +++ b/README.md @@ -368,7 +368,7 @@ which sets all units rounding precision to 3 digits except `px` unit precision o ## How to rebase relative image URLs? -clean-css-cli will handle it automatically for you when full paths to input files are passed in and `--output` option is used, e.g +clean-css-cli will rebase paths it automatically for you when full paths to input files are passed, and `--with-rebase` & `--output` options are used, e.g ```css /*! one.css */ @@ -378,7 +378,7 @@ a { ``` ```shell -cleancss -o build/one.min.css one.css +cleancss --with-rebase -o build/one.min.css one.css ``` ```css From 144efb542961e1ad380a9ca6fd69e038ddfc6f23 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 5 Feb 2021 15:08:17 +0100 Subject: [PATCH 23/96] Updates an example of dealing with CLI module interface. --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 14f03b2..197a939 100644 --- a/README.md +++ b/README.md @@ -329,12 +329,20 @@ clean-css-cli can also be used as a module in a way of enhancing its functionali var cleanCssCli = require('clean-css-cli'); -return cleanCssCli(process, function beforeMinify(cleanCss) { - cleanCss.options.level['1'].transform = function (propertyName, propertyValue) { - if (propertyName == 'background-image' && propertyValue.indexOf('../valid/path/to') == -1) { - return propertyValue.replace('url(', 'url(../valid/path/to/'); +var customPlugin = { + level1: { + value: function (propertyName, propertyValue, options) { + if (propertyName == 'background-image' && propertyValue.indexOf('../valid/path/to') == -1) { + return propertyValue.replace('url(', 'url(../valid/path/to/'); + } else { + return propertyValue; + } } } +} + +return cleanCssCli(process, function (cleanCss) { + cleanCss.options.plugins.level1Value.push(customPlugin.level1.value); }); ``` From 1daac06d132be55a9db6642a203153f02ba9c710 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 10 Feb 2021 13:11:28 +0100 Subject: [PATCH 24/96] Removes Twitter mention in package.json. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4427114..2884462 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "bin": { "cleancss": "./bin/cleancss" }, - "author": "Jakub Pawlowicz (http://twitter.com/jakubpawlowicz)", + "author": "Jakub Pawlowicz ", "license": "MIT", "bugs": { "url": "https://github.com/jakubpawlowicz/clean-css-cli/issues" From 6f9c9f98ae2134bfeb7186f342dcccdb462ecc15 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 10 Feb 2021 13:19:30 +0100 Subject: [PATCH 25/96] Adds FAQ section on new `--batch` option. --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 197a939..c41a305 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0. * [As a module](#as-a-module) - [FAQ](#faq) * [How to optimize multiple files?](#how-to-optimize-multiple-files) + * [How to process multiple files without concatenating them into one output file?](#how-to-process-multiple-files-without-concatenating-them-into-one-output-file) * [How to specify a custom rounding precision?](#how-to-specify-a-custom-rounding-precision) * [How to rebase relative image URLs?](#how-to-rebase-relative-image-urls) * [How to apply level 1 & 2 optimizations at the same time?](#how-to-apply-level-1--2-optimizations-at-the-same-time) @@ -364,6 +365,24 @@ Since version 4.1.0 it can also be done using glob pattern matching, e.g. cleancss -o merged.min.css *.css ``` +## How to process multiple files without concatenating them into one output file? + +Since clean-css-cli 5.0 you can optimize files one by one, without joining them into one output file, e.g. + +```shell +cleancss --batch styles/*.css +``` + +By default it will pick up every single file from `styles` directory, optimize it, add a `-min` suffix to filename (before extension), and write it to disk. + +You can use `--batch-suffix` option to customize the `-min` suffix, e.g. + +```shell +cleancss --batch --batch-suffix '.min' styles/*.css +``` + +Remember you can use [glob matching](https://www.npmjs.com/package/glob#glob-primer) to match exactly the files you want. + ## How to specify a custom rounding precision? The level 1 `roundingPrecision` optimization option accept a string with per-unit rounding precision settings, e.g. From 5a51baf90e1616c397e122cf47a0d0a53b100038 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 10 Feb 2021 13:28:38 +0100 Subject: [PATCH 26/96] Adds extra test covering `--batch` and `--output` used together. --- test/binary-test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/binary-test.js b/test/binary-test.js index 9c5b04c..75fabd5 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -803,4 +803,20 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'batch processing with output given': binaryContext('-b -o ./test ./test/fixtures/partials/one.css ./test/fixtures/partials/five.css', { + 'does not produce any errors': function (error) { + assert.equal(error, ''); + }, + 'creates two separate minified files': function () { + assert.isTrue(fs.existsSync('test/fixtures/partials/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures/partials/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures/partials/five-min.css')); + }, + 'teardown': function () { + deleteFile('test/fixtures/partials/one-min.css'); + deleteFile('test/fixtures/partials/five-min.css'); + } + }) + }) .export(module); From 417b248ceb25072f1e0989b9b181307c9a87e72e Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 10 Feb 2021 13:29:59 +0100 Subject: [PATCH 27/96] Version 5.0.0. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index bc1ccc9..cd88bc4 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.0.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.3...HEAD) +[5.0.0 / 2021-02-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.3...v5.0.0) ================== * Adds `--batch-suffix` option to specify what gets appended to output filename in batch mode. diff --git a/package-lock.json b/package-lock.json index d58ddf4..fa50a41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.0.0-pre", + "version": "5.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2884462..09a5f6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.0.0-pre", + "version": "5.0.0", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 10c0229e70bbb7453af8bb87150c5373a89c32d4 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 10 Feb 2021 15:44:26 +0200 Subject: [PATCH 28/96] README.md: fix `--with-rebase` description (#49) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c41a305..05747ea 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ clean-css-cli 4.0 introduces some breaking changes: --remove-inlined-files Remove files inlined in or via `@import` statements --source-map Enables building input's source map --source-map-inline-sources Enables inlining sources inside source maps ---with-rebase Disable URLs rebasing +--with-rebase Enables URLs rebasing ``` ## Compatibility modes From 7fe21282bae1f6c77ecdcce442b90d3a439e251b Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 10 Feb 2021 15:56:21 +0200 Subject: [PATCH 29/96] Update CI (#50) * specify `fail-fast: false` * update to `actions/setup-node@v2` * fix indentation --- .github/workflows/node.js.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 80c2bae..a6505c6 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -5,25 +5,25 @@ name: x86 Linux build on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: - runs-on: ubuntu-latest strategy: + fail-fast: false matrix: node-version: [10.x, 12.x, 14.x, 15.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm test From 52550b8fc34a601d42c019249e499088f4a64d65 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 10 Feb 2021 15:49:21 +0100 Subject: [PATCH 30/96] Removes temporarily unsupported test environments. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05747ea..eddc030 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0. # Node.js version support -clean-css-cli requires Node.js 10.0+ (tested on Linux, OS X, and Windows) +clean-css-cli requires Node.js 10.0+ (tested on Linux) # Install From 7e76d78f4f48714d78f0d0df4cee39d2583218af Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 10 Feb 2021 15:55:28 +0100 Subject: [PATCH 31/96] WIP: test failing fix. --- test/binary-test.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/binary-test.js b/test/binary-test.js index 75fabd5..0490cba 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -663,15 +663,15 @@ vows.describe('cleancss') 'topic': function() { var self = this; - exec('cp test/fixtures/reset.css test/fixtures/reset-removing.css', function () { - exec('__DIRECT__=1 ./bin/cleancss test/fixtures/reset-removing.css', self.callback); + exec('cp test/fixtures/reset.css test/fixtures/reset-removing-1.css', function () { + exec('__DIRECT__=1 ./bin/cleancss test/fixtures/reset-removing-1.css', self.callback); }); }, 'keeps the file': function () { - assert.isTrue(fs.existsSync('test/fixtures/reset-removing.css')); + assert.isTrue(fs.existsSync('test/fixtures/reset-removing-1.css')); }, 'teardown': function () { - deleteFile('test/fixtures/reset-removing.css'); + deleteFile('test/fixtures/reset-removing-1.css'); } } }) @@ -680,12 +680,12 @@ vows.describe('cleancss') 'topic': function() { var self = this; - exec('cp test/fixtures/reset.css test/fixtures/reset-removing.css', function () { - exec('__DIRECT__=1 ./bin/cleancss --remove-inlined-files test/fixtures/reset-removing.css', self.callback); + exec('cp test/fixtures/reset.css test/fixtures/reset-removing-2.css', function () { + exec('__DIRECT__=1 ./bin/cleancss --remove-inlined-files test/fixtures/reset-removing-2.css', self.callback); }); }, 'removes the file': function () { - assert.isFalse(fs.existsSync('test/fixtures/reset-removing.css')); + assert.isFalse(fs.existsSync('test/fixtures/reset-removing-2.css')); } } }) @@ -694,12 +694,12 @@ vows.describe('cleancss') 'topic': function() { var self = this; - exec('cp test/fixtures/reset.css test/fixtures/reset-removing.css', function () { - exec('echo "@import \'test/fixtures/reset-removing.css\';" | ./bin/cleancss --remove-inlined-files', self.callback); + exec('cp test/fixtures/reset.css test/fixtures/reset-removing-3.css', function () { + exec('echo "@import \'test/fixtures/reset-removing-3.css\';" | ./bin/cleancss --remove-inlined-files', self.callback); }); }, 'removes the file': function () { - assert.isFalse(fs.existsSync('test/fixtures/reset-removing.css')); + assert.isFalse(fs.existsSync('test/fixtures/reset-removing-3.css')); } } }) From 4fae6cec4031f87a43529528abe577d57eaea13e Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 11 Feb 2021 08:07:14 +0100 Subject: [PATCH 32/96] Fixes #54 - rebasing is still on if output option is used. --- History.md | 5 +++++ index.js | 4 +++- test/binary-test.js | 42 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/History.md b/History.md index cd88bc4..d4adedb 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.0.1 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.0.0...5.0) +================== + +* Fixed issue [#54](https://github.com/jakubpawlowicz/clean-css-cli/issues/54) - rebasing is still on if output option is used. + [5.0.0 / 2021-02-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.3...v5.0.0) ================== diff --git a/index.js b/index.js index f69d15b..c252f6c 100644 --- a/index.js +++ b/index.js @@ -92,7 +92,9 @@ function cli(process, beforeMinifyCallback) { level: { 1: true }, output: inputOptions.output, rebase: inputOptions.withRebase ? true : false, - rebaseTo: ('output' in inputOptions) && inputOptions.output.length > 0 ? path.dirname(path.resolve(inputOptions.output)) : (inputOptions.withRebase ? process.cwd() : undefined), + rebaseTo: inputOptions.withRebase && ('output' in inputOptions) && inputOptions.output.length > 0 ? + path.dirname(path.resolve(inputOptions.output)) : + (inputOptions.withRebase ? process.cwd() : undefined), sourceMap: inputOptions.sourceMap, sourceMapInlineSources: inputOptions.sourceMapInlineSources }; diff --git a/test/binary-test.js b/test/binary-test.js index 0490cba..7994640 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -248,7 +248,7 @@ vows.describe('cleancss') assert.equal(stdout, 'a{background:url(../partials/extra/down.gif) 0 0 no-repeat}'); } }), - 'output': binaryContext('-o ./base1-min.css ./test/fixtures/partials-relative/base.css', { + 'output': binaryContext('--with-rebase -o ./base1-min.css ./test/fixtures/partials-relative/base.css', { 'should rewrite path relative to current path': function () { var minimized = fs.readFileSync('./base1-min.css', 'utf-8'); assert.equal(minimized, 'a{background:url(test/fixtures/partials/extra/down.gif) 0 0 no-repeat}'); @@ -301,13 +301,27 @@ vows.describe('cleancss') .addBatch({ 'complex import and skipped url rebasing': { 'absolute': binaryContext('./test/fixtures/rebasing/assets/ui.css', { - 'should rebase urls correctly': function (error, stdout) { + 'should not rebase urls': function (error, stdout) { assert.isNull(error); assert.include(stdout, 'url(../images/glyphs.gif)'); assert.include(stdout, 'url(../images/prev.gif)'); assert.include(stdout, 'url(../images/next.gif)'); } }) + }, + 'complex import, skipped url rebasing, and output file': { + 'absolute': binaryContext('-o ./test/ui-no-rebase.min.css ./test/fixtures/rebasing/assets/ui.css', { + 'should not rebase urls': function () { + var minimized = fs.readFileSync('./test/ui-no-rebase.min.css', 'utf-8'); + + assert.include(minimized, 'url(../images/glyphs.gif)'); + assert.include(minimized, 'url(../images/prev.gif)'); + assert.include(minimized, 'url(../images/next.gif)'); + }, + teardown: function () { + deleteFile('test/ui-no-rebase.min.css'); + } + }) } }) .addBatch({ @@ -545,7 +559,27 @@ vows.describe('cleancss') } }) .addBatch({ - 'source maps - output file with existing map': binaryContext('--source-map -o ./styles.min.css ./test/fixtures/source-maps/styles.css', { + 'source maps - output file with existing map and no rebasing': binaryContext('--source-map -o ./styles.min.css ./test/fixtures/source-maps/styles.css', { + 'includes right content in map file': function () { + var sourceMap = new SourceMapConsumer(fs.readFileSync('./styles.min.css.map', 'utf-8')); + assert.deepEqual( + sourceMap.originalPositionFor({ line: 1, column: 1 }), + { + source: 'test/fixtures/source-maps/styles.css', + line: 1, + column: 0, + name: null + } + ); + }, + 'teardown': function () { + deleteFile('styles.min.css'); + deleteFile('styles.min.css.map'); + } + }) + }) + .addBatch({ + 'source maps - output file with existing map': binaryContext('--source-map --with-rebase -o ./styles.min.css ./test/fixtures/source-maps/styles.css', { 'includes right content in map file': function () { var sourceMap = new SourceMapConsumer(fs.readFileSync('./styles.min.css.map', 'utf-8')); assert.deepEqual( @@ -565,7 +599,7 @@ vows.describe('cleancss') }) }) .addBatch({ - 'source maps - output file for existing map in different folder': binaryContext('--source-map -o ./styles-relative.min.css ./test/fixtures/source-maps/relative.css', { + 'source maps - output file for existing map in different folder': binaryContext('--source-map --with-rebase -o ./styles-relative.min.css ./test/fixtures/source-maps/relative.css', { 'includes right content in map file': function () { var sourceMap = new SourceMapConsumer(fs.readFileSync('./styles-relative.min.css.map', 'utf-8')); assert.deepEqual( From 293499ead59183f1c7a85533be8741caaeddb70f Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 11 Feb 2021 10:46:23 +0100 Subject: [PATCH 33/96] Rewrites batch tests so each uses their own fixtures. --- test/binary-test.js | 75 +++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/test/binary-test.js b/test/binary-test.js index 7994640..ab4c276 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -1,5 +1,6 @@ var assert = require('assert'); var exec = require('child_process').exec; +var execSync = require('child_process').execSync; var fs = require('fs'); var http = require('http'); var path = require('path'); @@ -12,6 +13,8 @@ var vows = require('vows'); function binaryContext(options, context) { context.topic = function () { + (context.setup || Function.prototype)(); + // We add __DIRECT__=1 to force binary into 'non-piped' mode exec('__DIRECT__=1 ./bin/cleancss ' + options, this.callback); }; @@ -788,68 +791,72 @@ vows.describe('cleancss') assert.equal(stdout, '.one{color:red}'); } }), - 'batch processing with explicitely given paths': binaryContext('-b ./test/fixtures/partials/one.css ./test/fixtures/partials/five.css', { + 'batch processing with explicitely given paths': binaryContext('-b ./test/fixtures-batch-1/partials/one.css ./test/fixtures-batch-1/partials/five.css', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-1'); + }, 'creates two separate minified files': function () { - assert.isTrue(fs.existsSync('test/fixtures/partials/one-min.css')); - assert.isFalse(fs.existsSync('test/fixtures/partials/two-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/five-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-1/partials/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-1/partials/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-1/partials/five-min.css')); }, 'teardown': function () { - deleteFile('test/fixtures/partials/one-min.css'); - deleteFile('test/fixtures/partials/five-min.css'); + execSync('rm -fr test/fixtures-batch-1'); } }) }) .addBatch({ - 'batch processing with wildard paths': binaryContext('-b ./test/fixtures/partials/\\*\\*/*.css', { + 'batch processing with wildard paths': binaryContext('-b ./test/fixtures-batch-2/partials/\\*\\*/*.css', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-2'); + }, 'creates two separate minified files': function () { - assert.isTrue(fs.existsSync('test/fixtures/partials/extra/four-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/extra/three-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/one-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/two-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/quoted-svg-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/five-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-2/partials/extra/four-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-2/partials/extra/three-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-2/partials/one-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-2/partials/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-2/partials/quoted-svg-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-2/partials/five-min.css')); }, 'teardown': function () { - deleteFile('test/fixtures/partials/extra/four-min.css'); - deleteFile('test/fixtures/partials/extra/three-min.css'); - deleteFile('test/fixtures/partials/one-min.css'); - deleteFile('test/fixtures/partials/two-min.css'); - deleteFile('test/fixtures/partials/quoted-svg-min.css'); - deleteFile('test/fixtures/partials/five-min.css'); + execSync('rm -fr test/fixtures-batch-2'); } }) }) .addBatch({ - 'batch processing with custom suffix': binaryContext('--batch --batch-suffix \'.min\' ./test/fixtures/partials/one.css ./test/fixtures/partials/five.css', { + 'batch processing with custom suffix': binaryContext('--batch --batch-suffix \'.min\' ./test/fixtures-batch-3/partials/one.css ./test/fixtures-batch-3/partials/five.css', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-3'); + }, 'creates two separate minified files': function () { - assert.isFalse(fs.existsSync('test/fixtures/partials/one-min.css')); - assert.isFalse(fs.existsSync('test/fixtures/partials/two-min.css')); - assert.isFalse(fs.existsSync('test/fixtures/partials/five-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-3/partials/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-3/partials/two-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-3/partials/five-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/one.min.css')); - assert.isFalse(fs.existsSync('test/fixtures/partials/two.min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/five.min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-3/partials/one.min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-3/partials/two.min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-3/partials/five.min.css')); }, 'teardown': function () { - deleteFile('test/fixtures/partials/one.min.css'); - deleteFile('test/fixtures/partials/five.min.css'); + execSync('rm -fr test/fixtures-batch-3'); } }) }) .addBatch({ - 'batch processing with output given': binaryContext('-b -o ./test ./test/fixtures/partials/one.css ./test/fixtures/partials/five.css', { + 'batch processing with output given': binaryContext('-b -o ./test ./test/fixtures-batch-4/partials/one.css ./test/fixtures-batch-4/partials/five.css', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-4'); + }, 'does not produce any errors': function (error) { assert.equal(error, ''); }, 'creates two separate minified files': function () { - assert.isTrue(fs.existsSync('test/fixtures/partials/one-min.css')); - assert.isFalse(fs.existsSync('test/fixtures/partials/two-min.css')); - assert.isTrue(fs.existsSync('test/fixtures/partials/five-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-4/partials/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-4/partials/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-4/partials/five-min.css')); }, 'teardown': function () { - deleteFile('test/fixtures/partials/one-min.css'); - deleteFile('test/fixtures/partials/five-min.css'); + execSync('rm -fr test/fixtures-batch-4'); } }) }) From 7cc282c2bb43481a36ccd73dd4cc31465623f012 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 11 Feb 2021 10:52:04 +0100 Subject: [PATCH 34/96] Don't execute empty 'setup' clauses. --- test/binary-test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/binary-test.js b/test/binary-test.js index ab4c276..fb92d10 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -14,6 +14,7 @@ var vows = require('vows'); function binaryContext(options, context) { context.topic = function () { (context.setup || Function.prototype)(); + delete context.setup; // We add __DIRECT__=1 to force binary into 'non-piped' mode exec('__DIRECT__=1 ./bin/cleancss ' + options, this.callback); From 96b2178033d03b8b4143f0f54e2c608525396a41 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 11 Feb 2021 08:11:04 +0100 Subject: [PATCH 35/96] Version 5.0.1. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index d4adedb..ed41583 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.0.1 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.0.0...5.0) +[5.0.1 / 2021-02-11](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.0.0...v5.0.1) ================== * Fixed issue [#54](https://github.com/jakubpawlowicz/clean-css-cli/issues/54) - rebasing is still on if output option is used. diff --git a/package-lock.json b/package-lock.json index fa50a41..256ff5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.0.0", + "version": "5.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 09a5f6f..9e43c11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.0.0", + "version": "5.0.1", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 4e9aba81762637cc7fb5c0b755df2f0a58151eaf Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 11 Feb 2021 14:32:15 +0100 Subject: [PATCH 36/96] Create FUNDING.yml --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..d11d019 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [jakubpawlowicz] From 0e4a81c35fa565f9e7f82939c2f59e2a5d1b1e18 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 11 Feb 2021 17:04:16 +0200 Subject: [PATCH 37/96] Add CodeQL action --- .github/workflows/codeql.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..fe10be7 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,34 @@ +name: "CodeQL" + +on: + push: + branches: + - master + - "!dependabot/**" + pull_request: + # The branches below must be a subset of the branches above + branches: + - master + schedule: + - cron: "0 2 * * 5" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: "javascript" + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From a0cec115ccee72488d26854006b56af6fe4eed3c Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 12 Feb 2021 09:36:37 +0100 Subject: [PATCH 38/96] Requires Node.js `>= 10.12.0` due to `fs.mkdirSync` recursive option. In earlier Node.js 10.x `mkdirSync` will fail if more than one directory level is missing. Thanks to @XhmikosR for pointing this out. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e43c11..2f1a68f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,6 @@ "vows": "^0.8.3" }, "engines": { - "node": ">= 10.0" + "node": ">= 10.12.0" } } From 944f447e9aaae6a5f6304998fc47de4fa1dc2fa3 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 11 Feb 2021 12:17:55 +0100 Subject: [PATCH 39/96] Fixes #51 - excluding files via glob negated pattern. --- History.md | 5 +++++ README.md | 13 +++++++++++++ index.js | 9 +++++++-- test/binary-test.js | 18 ++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index ed41583..00c6f68 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.1.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.0...HEAD) +================== + +* Fixed issue [#51](https://github.com/jakubpawlowicz/clean-css-cli/issues/51) - excluding files via glob negated pattern. + [5.0.1 / 2021-02-11](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.0.0...v5.0.1) ================== diff --git a/README.md b/README.md index eddc030..a5c1c66 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0. - [Node.js version support](#nodejs-version-support) - [Install](#install) - [Use](#use) + * [What's new in version 5.1](#whats-new-in-version-51) * [What's new in version 5.0](#whats-new-in-version-50) * [What's new in version 4.3](#whats-new-in-version-43) * [What's new in version 4.2](#whats-new-in-version-42) @@ -60,6 +61,12 @@ Note: Global install via -g option is recommended unless you want to execute the cleancss -o one.min.css one.css ``` +## What's new in version 5.1 + +clean-css-cli 5.1 will introduce the following changes / features: + +* accept `!path/to/file` as a way of telling `cleancss` to ignore such file, also accepts any available glob patterns. + ## What's new in version 5.0 clean-css-cli 5.0 introduces the following changes / features: @@ -383,6 +390,12 @@ cleancss --batch --batch-suffix '.min' styles/*.css Remember you can use [glob matching](https://www.npmjs.com/package/glob#glob-primer) to match exactly the files you want. +Since clean-css-cli 5.1 you can also use a negated pattern to exclude some files from being matched, e.g. + +```shell +cleancss --batch styles/*.css !styles/*.min.css +``` + ## How to specify a custom rounding precision? The level 1 `roundingPrecision` optimization option accept a string with per-unit rounding precision settings, e.g. diff --git a/index.js b/index.js index c252f6c..13d3af0 100644 --- a/index.js +++ b/index.js @@ -173,8 +173,13 @@ function findArgumentTo(option, rawArgs, args) { } function expandGlobs(paths) { - return paths.reduce(function (accumulator, path) { - return accumulator.concat(glob.sync(path, { nodir: true, nonull: true})); + var globPatterns = paths.filter(function (path) { return path[0] != '!'; }); + var ignoredGlobPatterns = paths + .filter(function (path) { return path[0] == '!'; }) + .map(function (path) { return path.substring(1); }); + + return globPatterns.reduce(function (accumulator, path) { + return accumulator.concat(glob.sync(path, { ignore: ignoredGlobPatterns, nodir: true, nonull: true })); }, []); } diff --git a/test/binary-test.js b/test/binary-test.js index fb92d10..75b2a1c 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -861,4 +861,22 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'batch processing with wildcard and exclude paths': binaryContext('-b ./test/fixtures-batch-5/partials/\\*\\*/*.css !./test/fixtures-batch-5/partials/one* !./test/fixtures-batch-5/partials/fiv?.css', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-5'); + }, + 'creates two separate minified files': function () { + assert.isTrue(fs.existsSync('test/fixtures-batch-5/partials/extra/four-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-5/partials/extra/three-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-5/partials/one-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-5/partials/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-5/partials/quoted-svg-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-5/partials/five-min.css')); + }, + 'teardown': function () { + execSync('rm -fr test/fixtures-batch-5'); + } + }) + }) .export(module); From d38300afdcaf1161cd963e97e36d7630514632e8 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 12 Feb 2021 09:44:52 +0100 Subject: [PATCH 40/96] Version 5.1.0. --- History.md | 2 +- README.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 00c6f68..099f928 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.1.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.0...HEAD) +[5.1.0 / 2021-02-12](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.0...v5.1.0) ================== * Fixed issue [#51](https://github.com/jakubpawlowicz/clean-css-cli/issues/51) - excluding files via glob negated pattern. diff --git a/README.md b/README.md index a5c1c66..16bd39c 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ cleancss -o one.min.css one.css ## What's new in version 5.1 -clean-css-cli 5.1 will introduce the following changes / features: +clean-css-cli 5.1 introduces the following changes / features: * accept `!path/to/file` as a way of telling `cleancss` to ignore such file, also accepts any available glob patterns. diff --git a/package-lock.json b/package-lock.json index 256ff5b..4d89bc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.0.1", + "version": "5.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2f1a68f..057c989 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.0.1", + "version": "5.1.0", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 09366121d0c3fd06a247a13ba0385f33936fecb3 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 18 Feb 2021 15:26:41 +0100 Subject: [PATCH 41/96] Bumps clean-css dependency to version 5.1.0. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 099f928..2b099fa 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.2.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.1...HEAD) +================== + +* Bumps clean-css dependency to 5.1.0. + [5.1.0 / 2021-02-12](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.0...v5.1.0) ================== diff --git a/package-lock.json b/package-lock.json index 4d89bc4..94f2f65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.0.1.tgz", - "integrity": "sha512-F1zAGOowUCg8yxT0O4UR+nmbMauf3YwbiUS60CPxpzJU7ulpamGzQomFrJSK4w/HqHtMmQKSHJUNue+dQQYQdg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.0.tgz", + "integrity": "sha512-98ALLW4NOhZpvUEoSc2dJO23xE4S4SXc4mLieCVFGo8DNLTFQ3gzi7msW1lqSYJeGZSF5r5+W3KF6cEnkILnFQ==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 057c989..7d82ece 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", "dependencies": { - "clean-css": "^5.0.1", + "clean-css": "^5.1.0", "commander": "7.x", "glob": "^7.1.6" }, From 74dfd3500ed3c7219dc498f95766872b52c34c78 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 18 Feb 2021 15:31:15 +0100 Subject: [PATCH 42/96] Version 5.2.0. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 2b099fa..855948a 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.2.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.1...HEAD) +[5.2.0 / 2021-02-18](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.1...v5.2.0) ================== * Bumps clean-css dependency to 5.1.0. diff --git a/package-lock.json b/package-lock.json index 94f2f65..f136552 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.1.0", + "version": "5.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7d82ece..4d7a736 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.1.0", + "version": "5.2.0", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 3a6f98ff7beea4509e0c84a4f546feab794ce337 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 3 Mar 2021 13:22:58 +0100 Subject: [PATCH 43/96] Adds more `batch-suffix` docs. --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 16bd39c..af703b5 100644 --- a/README.md +++ b/README.md @@ -385,7 +385,13 @@ By default it will pick up every single file from `styles` directory, optimize i You can use `--batch-suffix` option to customize the `-min` suffix, e.g. ```shell -cleancss --batch --batch-suffix '.min' styles/*.css +cleancss --batch --batch-suffix '.min' styles/*.css # output will have `.min` suffix before `.css`, e.g. styles.min.css +``` + +or + +```shell +cleancss --batch --batch-suffix '' styles/*.css # output files will OVERRIDE input files ``` Remember you can use [glob matching](https://www.npmjs.com/package/glob#glob-primer) to match exactly the files you want. From 15c31cefaa82bcd1901e411fa8616010904603b5 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 3 Mar 2021 19:17:24 +0100 Subject: [PATCH 44/96] Bumps clean-css dependency to version 5.1.1. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 855948a..c8e8a7e 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.2.1 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.0...5.2) +================== + +* Bumps clean-css dependency to 5.1.1. + [5.2.0 / 2021-02-18](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.1...v5.2.0) ================== diff --git a/package-lock.json b/package-lock.json index f136552..c71ad1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.0.tgz", - "integrity": "sha512-98ALLW4NOhZpvUEoSc2dJO23xE4S4SXc4mLieCVFGo8DNLTFQ3gzi7msW1lqSYJeGZSF5r5+W3KF6cEnkILnFQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.1.tgz", + "integrity": "sha512-GQ6HdEyJN0543mRTA/TkZ7RPoMXGWKq1shs9H86F2kLuixR0RI+xd4JfhJxWUW08FGKQXTKAKpVjKQXu5zkFNA==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 4d7a736..19523eb 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", "dependencies": { - "clean-css": "^5.1.0", + "clean-css": "^5.1.1", "commander": "7.x", "glob": "^7.1.6" }, From f90cc9a4e789e4ff53c1249e3c13b23c76e97cbf Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 3 Mar 2021 19:18:18 +0100 Subject: [PATCH 45/96] Version 5.2.1. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index c8e8a7e..616c379 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.2.1 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.0...5.2) +[5.2.1 / 2021-03-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.0...v5.2.1) ================== * Bumps clean-css dependency to 5.1.1. diff --git a/package-lock.json b/package-lock.json index c71ad1b..f7f72aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.2.0", + "version": "5.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 19523eb..d985cfa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.2.0", + "version": "5.2.1", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 4d28513f34b5abf093a67e9eb0e88859d412d8f8 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 19 Mar 2021 12:35:12 +0100 Subject: [PATCH 46/96] Bumps clean-css dependency to version 5.1.2. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 616c379..d991d8b 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.2.2 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.1...5.2) +================== + +* Bumps clean-css dependency to 5.1.2. + [5.2.1 / 2021-03-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.0...v5.2.1) ================== diff --git a/package-lock.json b/package-lock.json index f7f72aa..72d7f10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.1.tgz", - "integrity": "sha512-GQ6HdEyJN0543mRTA/TkZ7RPoMXGWKq1shs9H86F2kLuixR0RI+xd4JfhJxWUW08FGKQXTKAKpVjKQXu5zkFNA==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.2.tgz", + "integrity": "sha512-QcaGg9OuMo+0Ds933yLOY+gHPWbxhxqF0HDexmToPf8pczvmvZGYzd+QqWp9/mkucAOKViI+dSFOqoZIvXbeBw==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index d985cfa..d78f9f0 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", "dependencies": { - "clean-css": "^5.1.1", + "clean-css": "^5.1.2", "commander": "7.x", "glob": "^7.1.6" }, From e87acb7739e76af82b742fbae68a35391a19bbbd Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 19 Mar 2021 12:36:34 +0100 Subject: [PATCH 47/96] Version 5.2.2. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index d991d8b..2516d5d 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.2.2 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.1...5.2) +[5.2.2 / 2021-03-19](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.1...v5.2.2) ================== * Bumps clean-css dependency to 5.1.2. diff --git a/package-lock.json b/package-lock.json index 72d7f10..fd6853a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.2.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d78f9f0..b85a53c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.2.1", + "version": "5.2.2", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From faf9ed0a81f2a8118752e1d15e4c6f348a642e76 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Mon, 29 Mar 2021 21:09:08 +0200 Subject: [PATCH 48/96] Fixes #65 - batch processing with output path. When an output path is given (via `-o` or `--output`) while batch processing is turned on (via `-b` or `--batch`) then output files are written to a directory under output path, while the root of input wildcard is used as a base, e.g.: ```bash cleancss --batch --output dist/ source/**/*.css ``` will put `source/one.css` under `dist/one-min.css` and `source/vendor/two.css` under `dist/vendor/two-min.css`. In case of input path given explicitely they are written directly to output path, e.g. ```bash cleancss --batch --output dist/ source/one.css source/vendor/two.css ``` will put `source/one.css` under `dist/one-min.css` and `source/vendor/two.css` under `dist/two-min.css`. --- History.md | 5 +++++ index.js | 34 ++++++++++++++++++++++++++++++---- test/binary-test.js | 30 +++++++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/History.md b/History.md index 2516d5d..866059b 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.3.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.2...HEAD) +================== + +* Fixed issue [#65](https://github.com/jakubpawlowicz/clean-css-cli/issues/65) - batch processing with output path. + [5.2.2 / 2021-03-19](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.1...v5.2.2) ================== diff --git a/index.js b/index.js index 13d3af0..64c372a 100644 --- a/index.js +++ b/index.js @@ -120,6 +120,10 @@ function cli(process, beforeMinifyCallback) { options.sourceMap = false; } + if (options.output && options.batch) { + fs.mkdirSync(options.output, {recursive: true}); + } + var configurations = { batchSuffix: inputOptions.batchSuffix, beforeMinifyCallback: beforeMinifyCallback, @@ -179,21 +183,33 @@ function expandGlobs(paths) { .map(function (path) { return path.substring(1); }); return globPatterns.reduce(function (accumulator, path) { - return accumulator.concat(glob.sync(path, { ignore: ignoredGlobPatterns, nodir: true, nonull: true })); + var expandedWithSource = + glob.sync(path, { ignore: ignoredGlobPatterns, nodir: true, nonull: true }) + .map(function (expandedPath) { return { expanded: expandedPath, source: path }; }); + + return accumulator.concat(expandedWithSource); }, []); } function minify(process, options, configurations, data) { var cleanCss = new CleanCSS(options); + var input = typeof(data) == 'string' ? + data : + data.map(function (o) { return o.expanded; }); applyNonBooleanCompatibilityFlags(cleanCss, options.compatibility); configurations.beforeMinifyCallback(cleanCss); - cleanCss.minify(data, getSourceMapContent(configurations.inputSourceMap), function (errors, minified) { + cleanCss.minify(input, getSourceMapContent(configurations.inputSourceMap), function (errors, minified) { var inputPath; + var outputPath; if (options.batch && !('styles' in minified)) { for (inputPath in minified) { - processMinified(process, configurations, minified[inputPath], inputPath, toOutputPath(inputPath, configurations.batchSuffix)); + outputPath = options.batch && options.output ? + toBatchOutputPath(inputPath, configurations.batchSuffix, options.output, data) : + toSimpleOutputPath(inputPath, configurations.batchSuffix); + + processMinified(process, configurations, minified[inputPath], inputPath, outputPath); } } else { processMinified(process, configurations, minified, null, options.output); @@ -201,12 +217,22 @@ function minify(process, options, configurations, data) { }); } -function toOutputPath(inputPath, batchSuffix) { +function toSimpleOutputPath(inputPath, batchSuffix) { var extensionName = path.extname(inputPath); return inputPath.replace(new RegExp(extensionName + '$'), batchSuffix + extensionName); } +function toBatchOutputPath(inputPath, batchSuffix, output, expandedWithSource) { + var extensionName = path.extname(inputPath); + var inputSource = expandedWithSource.find(function (ic) { return ic.expanded == inputPath; }).source; + var inputSourceRoot = inputSource.indexOf('*') > -1 ? + inputSource.substring(0, inputSource.indexOf('*')) : + path.dirname(inputSource); + + return path.join(output, inputPath.replace(inputSourceRoot, '').replace(new RegExp(extensionName + '$'), batchSuffix + extensionName)); +} + function processMinified(process, configurations, minified, inputPath, outputPath) { var mapOutputPath; diff --git a/test/binary-test.js b/test/binary-test.js index 75b2a1c..63db290 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -844,7 +844,7 @@ vows.describe('cleancss') }) }) .addBatch({ - 'batch processing with output given': binaryContext('-b -o ./test ./test/fixtures-batch-4/partials/one.css ./test/fixtures-batch-4/partials/five.css', { + 'batch processing with output given': binaryContext('-b -o ./test/fixtures-batch-4-output ./test/fixtures-batch-4/partials/one.css ./test/fixtures-batch-4/partials/five.css', { 'setup': function () { execSync('cp -fr test/fixtures test/fixtures-batch-4'); }, @@ -852,12 +852,17 @@ vows.describe('cleancss') assert.equal(error, ''); }, 'creates two separate minified files': function () { - assert.isTrue(fs.existsSync('test/fixtures-batch-4/partials/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-4/partials/one-min.css')); assert.isFalse(fs.existsSync('test/fixtures-batch-4/partials/two-min.css')); - assert.isTrue(fs.existsSync('test/fixtures-batch-4/partials/five-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-4/partials/five-min.css')); + + assert.isTrue(fs.existsSync('test/fixtures-batch-4-output/one-min.css')); + assert.isFalse(fs.existsSync('test/fixtures-batch-4-output/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-4-output/five-min.css')); }, 'teardown': function () { execSync('rm -fr test/fixtures-batch-4'); + execSync('rm -fr test/fixtures-batch-4-output'); } }) }) @@ -879,4 +884,23 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'batch processing with output as a path': binaryContext('-b ./test/fixtures-batch-6/partials/\\*\\*/*.css -o test/fixtures-batch-6-output', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-6'); + }, + 'creates two separate minified files': function () { + assert.isTrue(fs.existsSync('test/fixtures-batch-6-output/extra/four-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-6-output/extra/three-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-6-output/one-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-6-output/two-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-6-output/quoted-svg-min.css')); + assert.isTrue(fs.existsSync('test/fixtures-batch-6-output/five-min.css')); + }, + 'teardown': function () { + execSync('rm -fr test/fixtures-batch-6'); + execSync('rm -fr test/fixtures-batch-6-output'); + } + }) + }) .export(module); From b4377828321e40ecce9c32b4bd9c9d2ddd3f9b97 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 8 Apr 2021 20:23:49 +0200 Subject: [PATCH 49/96] See #61 - source maps not being built in batch mode. Batch mode works without setting `--output` option and CLI wrongly assumed an output is needed for source maps to work. --- index.js | 2 +- test/binary-test.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 64c372a..250f0a8 100644 --- a/index.js +++ b/index.js @@ -115,7 +115,7 @@ function cli(process, beforeMinifyCallback) { options.sourceMap = true; } - if (options.sourceMap && !options.output) { + if (options.sourceMap && !options.output && !options.batch) { outputFeedback(['Source maps will not be built because you have not specified an output file.'], true); options.sourceMap = false; } diff --git a/test/binary-test.js b/test/binary-test.js index 63db290..e9df5d4 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -903,4 +903,49 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'batch processing with source maps': binaryContext('-b ./test/fixtures-batch-7/partials/\\*\\*/*.css --source-map', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-7'); + execSync('rm -fr test/fixtures-batch-7/partials/extra/four.css'); + execSync('touch test/fixtures-batch-7/partials/extra/four.css'); + }, + 'does not raise an error': function (error, stdout, stderr) { + assert.equal(stderr, ''); + }, + 'creates source map files': function () { + assert.isTrue(fs.existsSync('test/fixtures-batch-7/partials/extra/three-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-7/partials/one-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-7/partials/two-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-7/partials/quoted-svg-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-7/partials/five-min.css.map')); + }, + 'teardown': function () { + execSync('rm -fr test/fixtures-batch-7'); + } + }) + }) + .addBatch({ + 'batch processing with source maps and output as a path': binaryContext('-b ./test/fixtures-batch-8/partials/\\*\\*/*.css --source-map -o test/fixtures-batch-8-output', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-8'); + execSync('rm -fr test/fixtures-batch-8/partials/extra/four.css'); + execSync('touch test/fixtures-batch-8/partials/extra/four.css'); + }, + 'does not raise an error': function (error, stdout, stderr) { + assert.equal(stderr, ''); + }, + 'creates source map files': function () { + assert.isTrue(fs.existsSync('test/fixtures-batch-8-output/extra/three-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-8-output/one-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-8-output/two-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-8-output/quoted-svg-min.css.map')); + assert.isTrue(fs.existsSync('test/fixtures-batch-8-output/five-min.css.map')); + }, + 'teardown': function () { + execSync('rm -fr test/fixtures-batch-8'); + execSync('rm -fr test/fixtures-batch-8-output'); + } + }) + }) .export(module); From ae0e1a565a64fbb89eb1acd50c65f518c81d9edb Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 8 Apr 2021 21:03:55 +0200 Subject: [PATCH 50/96] See #61 - fixes invalid rebasing when `--output` is a directory. In such cases there `rebaseTo` option passed to `clean-css` is just the output directory. --- History.md | 1 + index.js | 28 +++++++++++++++++++++++++--- test/binary-test.js | 21 +++++++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 866059b..e16ffc2 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,7 @@ [5.3.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.2...HEAD) ================== +* Fixed issue [#61](https://github.com/jakubpawlowicz/clean-css-cli/issues/61) - source maps, rebasing, and batch processing. * Fixed issue [#65](https://github.com/jakubpawlowicz/clean-css-cli/issues/65) - batch processing with output path. [5.2.2 / 2021-03-19](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.1...v5.2.2) diff --git a/index.js b/index.js index 250f0a8..b207447 100644 --- a/index.js +++ b/index.js @@ -92,9 +92,7 @@ function cli(process, beforeMinifyCallback) { level: { 1: true }, output: inputOptions.output, rebase: inputOptions.withRebase ? true : false, - rebaseTo: inputOptions.withRebase && ('output' in inputOptions) && inputOptions.output.length > 0 ? - path.dirname(path.resolve(inputOptions.output)) : - (inputOptions.withRebase ? process.cwd() : undefined), + rebaseTo: undefined, sourceMap: inputOptions.sourceMap, sourceMapInlineSources: inputOptions.sourceMapInlineSources }; @@ -124,6 +122,18 @@ function cli(process, beforeMinifyCallback) { fs.mkdirSync(options.output, {recursive: true}); } + if (inputOptions.withRebase && ('output' in inputOptions) && inputOptions.output.length > 0) { + if (isDirectory(path.resolve(inputOptions.output))) { + options.rebaseTo = path.resolve(inputOptions.output); + } else { + options.rebaseTo = path.dirname(path.resolve(inputOptions.output)); + } + } else { + if (inputOptions.withRebase) { + options.rebaseTo = process.cwd(); + } + } + var configurations = { batchSuffix: inputOptions.batchSuffix, beforeMinifyCallback: beforeMinifyCallback, @@ -148,6 +158,18 @@ function cli(process, beforeMinifyCallback) { } } +function isDirectory(path) { + try { + return fs.statSync(path).isDirectory(); + } catch (e) { + if (e.code == 'ENOENT') { + return false; + } else { + throw e; + } + } +} + function findArgumentTo(option, rawArgs, args) { var value = true; var optionAt = rawArgs.indexOf(option); diff --git a/test/binary-test.js b/test/binary-test.js index e9df5d4..65d6673 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -948,4 +948,25 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'batch processing with source maps, rebase and output as a path': binaryContext('-b ./test/fixtures-batch-9/partials-relative/\\*\\*/included.css --source-map --with-rebase -o test/fixtures-batch-9-output', { + 'setup': function () { + execSync('cp -fr test/fixtures test/fixtures-batch-9'); + }, + 'does not raise an error': function (error, stdout, stderr) { + assert.equal(stderr, ''); + }, + 'rebases output correctly': function () { + var minimized = fs.readFileSync('./test/fixtures-batch-9-output/extra/included-min.css', 'utf-8'); + assert.equal(minimized, 'a{background:url(../fixtures-batch-9/partials/extra/down.gif) 0 0 no-repeat}\n/*# sourceMappingURL=included-min.css.map */'); + }, + 'creates source map files': function () { + assert.isTrue(fs.existsSync('test/fixtures-batch-9-output/extra/included-min.css.map')); + }, + 'teardown': function () { + execSync('rm -fr test/fixtures-batch-9'); + execSync('rm -fr test/fixtures-batch-9-output'); + } + }) + }) .export(module); From 8fed659019cd6bdd3c0d17c5f112d885ad8740e9 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 28 Apr 2021 14:24:52 +0200 Subject: [PATCH 51/96] Version 5.3.0. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index e16ffc2..bbfaf0f 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.3.0 / 2021-xx-xx](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.2...HEAD) +[5.3.0 / 2021-04-28](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.2...5.3) ================== * Fixed issue [#61](https://github.com/jakubpawlowicz/clean-css-cli/issues/61) - source maps, rebasing, and batch processing. diff --git a/package-lock.json b/package-lock.json index fd6853a..6ed4897 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.2.2", + "version": "5.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b85a53c..79b9710 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.2.2", + "version": "5.3.0", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From bc43efc9646cfc34b3d643cacdb2e7a3d9addbac Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 28 Apr 2021 14:30:11 +0200 Subject: [PATCH 52/96] Fixes changelog diff. --- History.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/History.md b/History.md index bbfaf0f..0c84d9e 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.3.0 / 2021-04-28](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.2...5.3) +[5.3.0 / 2021-04-28](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.2...v5.3.0) ================== * Fixed issue [#61](https://github.com/jakubpawlowicz/clean-css-cli/issues/61) - source maps, rebasing, and batch processing. From d11d6eec2bd2297d0719c6757716d675de29a265 Mon Sep 17 00:00:00 2001 From: David Beitey Date: Wed, 5 May 2021 05:14:28 +0000 Subject: [PATCH 53/96] Update readme to replace --level option with -O This change removes mention of the `--level` option which never existed. In versions earlier than 5.0.0, clean-css-cli used to accept the invalid option silently. With versions > 5.0.0, trying to use the option results in the following: `error: unknown option '--level'`. The root cause of the change the upgrade to [commander v7.0.0](https://github.com/tj/commander.js/pull/1409), where unknown (excess) command arguments are now raised as an error. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af703b5..34df496 100644 --- a/README.md +++ b/README.md @@ -238,10 +238,10 @@ cleancss --inline 'local,remote,!fonts.googleapis.com' one.css ## Optimization levels -The `--level` option can be either `0`, `1` (default), or `2`, e.g. +The `-O` option can be either `0`, `1` (default), or `2`, e.g. ```shell -cleancss --level 2 one.css +cleancss -O2 one.css ``` or a fine-grained configuration given via a string. From a44b1c7bc8cc9eae96914c3cd8f1f41e79384ada Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 7 Jul 2021 12:15:46 +0200 Subject: [PATCH 54/96] Updates links after move to clean-css organization. --- CONTRIBUTING.md | 2 +- History.md | 96 ++++++++++++++++++++++++------------------------- README.md | 10 +++--- package.json | 6 ++-- 4 files changed, 57 insertions(+), 57 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 61636b2..854e45e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ At the end make sure code styling validation passes: npm run check ``` -Finally push to your fork and [submit a pull request](https://github.com/jakubpawlowicz/clean-css-cli/compare/). +Finally push to your fork and [submit a pull request](https://github.com/clean-css/clean-css-cli/compare/). At this point you're waiting for a PR review which should not thake more than a day. diff --git a/History.md b/History.md index 0c84d9e..7b8925d 100644 --- a/History.md +++ b/History.md @@ -1,175 +1,175 @@ -[5.3.0 / 2021-04-28](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.2...v5.3.0) +[5.3.0 / 2021-04-28](https://github.com/clean-css/clean-css-cli/compare/5.2...v5.3.0) ================== -* Fixed issue [#61](https://github.com/jakubpawlowicz/clean-css-cli/issues/61) - source maps, rebasing, and batch processing. -* Fixed issue [#65](https://github.com/jakubpawlowicz/clean-css-cli/issues/65) - batch processing with output path. +* Fixed issue [#61](https://github.com/clean-css/clean-css-cli/issues/61) - source maps, rebasing, and batch processing. +* Fixed issue [#65](https://github.com/clean-css/clean-css-cli/issues/65) - batch processing with output path. -[5.2.2 / 2021-03-19](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.1...v5.2.2) +[5.2.2 / 2021-03-19](https://github.com/clean-css/clean-css-cli/compare/v5.2.1...v5.2.2) ================== * Bumps clean-css dependency to 5.1.2. -[5.2.1 / 2021-03-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.0...v5.2.1) +[5.2.1 / 2021-03-03](https://github.com/clean-css/clean-css-cli/compare/v5.2.0...v5.2.1) ================== * Bumps clean-css dependency to 5.1.1. -[5.2.0 / 2021-02-18](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.1...v5.2.0) +[5.2.0 / 2021-02-18](https://github.com/clean-css/clean-css-cli/compare/5.1...v5.2.0) ================== * Bumps clean-css dependency to 5.1.0. -[5.1.0 / 2021-02-12](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.0...v5.1.0) +[5.1.0 / 2021-02-12](https://github.com/clean-css/clean-css-cli/compare/5.0...v5.1.0) ================== -* Fixed issue [#51](https://github.com/jakubpawlowicz/clean-css-cli/issues/51) - excluding files via glob negated pattern. +* Fixed issue [#51](https://github.com/clean-css/clean-css-cli/issues/51) - excluding files via glob negated pattern. -[5.0.1 / 2021-02-11](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.0.0...v5.0.1) +[5.0.1 / 2021-02-11](https://github.com/clean-css/clean-css-cli/compare/v5.0.0...v5.0.1) ================== -* Fixed issue [#54](https://github.com/jakubpawlowicz/clean-css-cli/issues/54) - rebasing is still on if output option is used. +* Fixed issue [#54](https://github.com/clean-css/clean-css-cli/issues/54) - rebasing is still on if output option is used. -[5.0.0 / 2021-02-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.3...v5.0.0) +[5.0.0 / 2021-02-10](https://github.com/clean-css/clean-css-cli/compare/4.3...v5.0.0) ================== * Adds `--batch-suffix` option to specify what gets appended to output filename in batch mode. * Bumps clean-css dependency to 5.0. * Bumps commander dependency to 7.0. -* Fixed issue [#18](https://github.com/jakubpawlowicz/clean-css-cli/issues/18) - allows batch processing of input files. -* Fixed issue [#36](https://github.com/jakubpawlowicz/clean-css-cli/issues/36) - automatically creates missing output directories. +* Fixed issue [#18](https://github.com/clean-css/clean-css-cli/issues/18) - allows batch processing of input files. +* Fixed issue [#36](https://github.com/clean-css/clean-css-cli/issues/36) - automatically creates missing output directories. -[4.3.0 / 2019-04-06](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.2...v4.3.0) +[4.3.0 / 2019-04-06](https://github.com/clean-css/clean-css-cli/compare/4.2...v4.3.0) ================== * Bumps clean-css dependency to 4.2.1. -* Fixed issue [#21](https://github.com/jakubpawlowicz/clean-css-cli/issues/21) - sanity check for printing out help. -* Fixed issue [#27](https://github.com/jakubpawlowicz/clean-css-cli/issues/27) - way to provide input source map. +* Fixed issue [#21](https://github.com/clean-css/clean-css-cli/issues/21) - sanity check for printing out help. +* Fixed issue [#27](https://github.com/clean-css/clean-css-cli/issues/27) - way to provide input source map. -[4.2.0 / 2018-08-02](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.1...v4.2.0) +[4.2.0 / 2018-08-02](https://github.com/clean-css/clean-css-cli/compare/4.1...v4.2.0) ================== * Bumps clean-css dependency to 4.2.0. -[4.1.11 / 2018-03-02](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.10...v4.1.11) +[4.1.11 / 2018-03-02](https://github.com/clean-css/clean-css-cli/compare/v4.1.10...v4.1.11) ================== -* Fixed issue [#17](https://github.com/jakubpawlowicz/clean-css-cli/issues/17) - empty `--inline` switch. +* Fixed issue [#17](https://github.com/clean-css/clean-css-cli/issues/17) - empty `--inline` switch. -[4.1.10 / 2017-09-19](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.9...v4.1.10) +[4.1.10 / 2017-09-19](https://github.com/clean-css/clean-css-cli/compare/v4.1.9...v4.1.10) ================== * Bumps clean-css dependency to 4.1.9. -[4.1.9 / 2017-09-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.8...v4.1.9) +[4.1.9 / 2017-09-03](https://github.com/clean-css/clean-css-cli/compare/v4.1.8...v4.1.9) ================== * Bumps clean-css dependency to 4.1.8. -[4.1.8 / 2017-09-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.7...v4.1.8) +[4.1.8 / 2017-09-03](https://github.com/clean-css/clean-css-cli/compare/v4.1.7...v4.1.8) ================== * Bumps clean-css dependency to 4.1.7. -[4.1.7 / 2017-09-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.6...v4.1.7) +[4.1.7 / 2017-09-03](https://github.com/clean-css/clean-css-cli/compare/v4.1.6...v4.1.7) ================== * Bumps clean-css dependency to 4.1.6. -[4.1.6 / 2017-06-29](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.5...v4.1.6) +[4.1.6 / 2017-06-29](https://github.com/clean-css/clean-css-cli/compare/v4.1.5...v4.1.6) ================== * Bumps clean-css dependency to 4.1.5. -[4.1.5 / 2017-06-14](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.4...v4.1.5) +[4.1.5 / 2017-06-14](https://github.com/clean-css/clean-css-cli/compare/v4.1.4...v4.1.5) ================== * Bumps clean-css dependency to 4.1.4. -[4.1.4 / 2017-06-09](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.3...v4.1.4) +[4.1.4 / 2017-06-09](https://github.com/clean-css/clean-css-cli/compare/v4.1.3...v4.1.4) ================== -* Fixed issue [#10](https://github.com/jakubpawlowicz/clean-css-cli/issues/10) - IE/Edge source maps. +* Fixed issue [#10](https://github.com/clean-css/clean-css-cli/issues/10) - IE/Edge source maps. -[4.1.3 / 2017-05-18](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.2...v4.1.3) +[4.1.3 / 2017-05-18](https://github.com/clean-css/clean-css-cli/compare/v4.1.2...v4.1.3) ================== * Bumps clean-css dependency to 4.1.3. -[4.1.2 / 2017-05-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.1...v4.1.2) +[4.1.2 / 2017-05-10](https://github.com/clean-css/clean-css-cli/compare/v4.1.1...v4.1.2) ================== * Bumps clean-css dependency to 4.1.2. -[4.1.1 / 2017-05-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.0...v4.1.1) +[4.1.1 / 2017-05-10](https://github.com/clean-css/clean-css-cli/compare/v4.1.0...v4.1.1) ================== * Bumps clean-css dependency to 4.1.1. -[4.1.0 / 2017-05-08](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.0...v4.1.0) +[4.1.0 / 2017-05-08](https://github.com/clean-css/clean-css-cli/compare/4.0...v4.1.0) ================== * Bumps clean-css dependency to 4.1.x. -* Fixed issue [#1](https://github.com/jakubpawlowicz/clean-css-cli/issues/1) - option to remove inlined files. -* Fixed issue [#2](https://github.com/jakubpawlowicz/clean-css-cli/issues/2) - glob matching source paths. -* Fixed issue [#5](https://github.com/jakubpawlowicz/clean-css-cli/issues/5) - non-boolean compatibility options. -* Fixed issue [#7](https://github.com/jakubpawlowicz/clean-css-cli/issues/7) - using CLI as a module. +* Fixed issue [#1](https://github.com/clean-css/clean-css-cli/issues/1) - option to remove inlined files. +* Fixed issue [#2](https://github.com/clean-css/clean-css-cli/issues/2) - glob matching source paths. +* Fixed issue [#5](https://github.com/clean-css/clean-css-cli/issues/5) - non-boolean compatibility options. +* Fixed issue [#7](https://github.com/clean-css/clean-css-cli/issues/7) - using CLI as a module. -[4.0.12 / 2017-04-12](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.11...v4.0.12) +[4.0.12 / 2017-04-12](https://github.com/clean-css/clean-css-cli/compare/v4.0.11...v4.0.12) ================== * Bumps clean-css dependency to 4.0.12. -[4.0.11 / 2017-04-11](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.10...v4.0.11) +[4.0.11 / 2017-04-11](https://github.com/clean-css/clean-css-cli/compare/v4.0.10...v4.0.11) ================== * Bumps clean-css dependency to 4.0.11. -[4.0.10 / 2017-03-22](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.9...v4.0.10) +[4.0.10 / 2017-03-22](https://github.com/clean-css/clean-css-cli/compare/v4.0.9...v4.0.10) ================== * Bumps clean-css dependency to 4.0.10. -[4.0.9 / 2017-03-15](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.8...v4.0.9) +[4.0.9 / 2017-03-15](https://github.com/clean-css/clean-css-cli/compare/v4.0.8...v4.0.9) ================== * Bumps clean-css dependency to 4.0.9. -[4.0.8 / 2017-02-22](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.7...v4.0.8) +[4.0.8 / 2017-02-22](https://github.com/clean-css/clean-css-cli/compare/v4.0.7...v4.0.8) ================== * Bumps clean-css dependency to 4.0.8. -[4.0.7 / 2017-02-14](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.6...v4.0.7) +[4.0.7 / 2017-02-14](https://github.com/clean-css/clean-css-cli/compare/v4.0.6...v4.0.7) ================== * Bumps clean-css dependency to 4.0.7. -[4.0.6 / 2017-02-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.5...v4.0.6) +[4.0.6 / 2017-02-10](https://github.com/clean-css/clean-css-cli/compare/v4.0.5...v4.0.6) ================== * Bumps clean-css dependency to 4.0.6. -[4.0.5 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.4...v4.0.5) +[4.0.5 / 2017-02-07](https://github.com/clean-css/clean-css-cli/compare/v4.0.4...v4.0.5) ================== * Bumps clean-css dependency to 4.0.5. -[4.0.4 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.3...v4.0.4) +[4.0.4 / 2017-02-07](https://github.com/clean-css/clean-css-cli/compare/v4.0.3...v4.0.4) ================== * Bumps clean-css dependency to 4.0.4. -[4.0.3 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.2...v4.0.3) +[4.0.3 / 2017-02-07](https://github.com/clean-css/clean-css-cli/compare/v4.0.2...v4.0.3) ================== * Bumps clean-css dependency to 4.0.3. -[4.0.2 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.1...v4.0.2) +[4.0.2 / 2017-02-07](https://github.com/clean-css/clean-css-cli/compare/v4.0.1...v4.0.2) ================== * Bumps clean-css dependency to 4.0.2. -[4.0.1 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.0...v4.0.1) +[4.0.1 / 2017-02-07](https://github.com/clean-css/clean-css-cli/compare/v4.0.0...v4.0.1) ================== * Bumps clean-css dependency to 4.0.1. @@ -178,4 +178,4 @@ ================== * Initial release of separate clean-css-cli. -* See [clean-css release notes](https://github.com/jakubpawlowicz/clean-css/blob/master/History.md#400--2017-01-23) for a full list of changes. +* See [clean-css release notes](https://github.com/clean-css/clean-css/blob/master/History.md#400--2017-01-23) for a full list of changes. diff --git a/README.md b/README.md index 34df496..f7f8b49 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ [![NPM version](https://img.shields.io/npm/v/clean-css-cli.svg?style=flat)](https://www.npmjs.com/package/clean-css-cli) -![x86 Linux build](https://github.com/jakubpawlowicz/clean-css-cli/workflows/x86%20Linux%20build/badge.svg) -[![Dependency Status](https://img.shields.io/david/jakubpawlowicz/clean-css-cli.svg?style=flat)](https://david-dm.org/jakubpawlowicz/clean-css-cli) +![x86 Linux build](https://github.com/clean-css/clean-css-cli/workflows/x86%20Linux%20build/badge.svg) +[![Dependency Status](https://img.shields.io/david/clean-css/clean-css-cli.svg?style=flat)](https://david-dm.org/clean-css/clean-css-cli) [![NPM Downloads](https://img.shields.io/npm/dm/clean-css-cli.svg)](https://www.npmjs.com/package/clean-css-cli) clean-css-cli is a command-line interface to [clean-css](https://github.com/jakubpawlowicz/clean-css) - fast and efficient CSS optimizer for [Node.js](http://nodejs.org/). @@ -444,14 +444,14 @@ will apply level 1 optimizations, except url normalization, and default level 2 # Contributing -See [CONTRIBUTING.md](https://github.com/jakubpawlowicz/clean-css-cli/blob/master/CONTRIBUTING.md). +See [CONTRIBUTING.md](https://github.com/clean-css/clean-css-cli/blob/master/CONTRIBUTING.md). ## How to get started? First clone the sources: ```shell -git clone git@github.com:jakubpawlowicz/clean-css-cli.git +git clone git@github.com:clean-css/clean-css-cli.git ``` then install dependencies: @@ -470,4 +470,4 @@ npm test # to run all tests # License -clean-css-cli is released under the [MIT License](https://github.com/jakubpawlowicz/clean-css-cli/blob/master/LICENSE). +clean-css-cli is released under the [MIT License](https://github.com/clean-css/clean-css-cli/blob/master/LICENSE). diff --git a/package.json b/package.json index 79b9710..0596fdb 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/jakubpawlowicz/clean-css-cli.git" + "url": "git+https://github.com/clean-css/clean-css-cli.git" }, "keywords": [ "css", @@ -22,7 +22,7 @@ "author": "Jakub Pawlowicz ", "license": "MIT", "bugs": { - "url": "https://github.com/jakubpawlowicz/clean-css-cli/issues" + "url": "https://github.com/clean-css/clean-css-cli/issues" }, "main": "index.js", "files": [ @@ -32,7 +32,7 @@ "LICENSE", "README.md" ], - "homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme", + "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { "clean-css": "^5.1.2", "commander": "7.x", From 7f4fab971466f73fca0684c681505008f06d2242 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 29 Jul 2021 11:48:39 +0200 Subject: [PATCH 55/96] Bumps clean-css dependency to version 5.1.3. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 7b8925d..0069ed5 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.3.1 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.3.0...5.3) +================== + +* Bumps clean-css dependency to 5.1.3. + [5.3.0 / 2021-04-28](https://github.com/clean-css/clean-css-cli/compare/5.2...v5.3.0) ================== diff --git a/package-lock.json b/package-lock.json index 6ed4897..6f443d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.2.tgz", - "integrity": "sha512-QcaGg9OuMo+0Ds933yLOY+gHPWbxhxqF0HDexmToPf8pczvmvZGYzd+QqWp9/mkucAOKViI+dSFOqoZIvXbeBw==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.3.tgz", + "integrity": "sha512-qGXzUCDpLwAlPx0kYeU4QXjzQIcIYZbJjD4FNm7NnSjoP0hYMVZhHOpUYJ6AwfkMX2cceLRq54MeCgHy/va1cA==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 0596fdb..3b05e07 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { - "clean-css": "^5.1.2", + "clean-css": "5.1.3", "commander": "7.x", "glob": "^7.1.6" }, From 2d7f1dd641aa29256270b1c7027839d584d34e98 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 29 Jul 2021 11:49:10 +0200 Subject: [PATCH 56/96] Version 5.3.1. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 0069ed5..2e4a82d 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.3.1 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.3.0...5.3) +[5.3.1 / 2021-07-29](https://github.com/clean-css/clean-css-cli/compare/v5.3.0...v5.3.1) ================== * Bumps clean-css dependency to 5.1.3. diff --git a/package-lock.json b/package-lock.json index 6f443d5..37e8269 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.0", + "version": "5.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3b05e07..e99aa52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.0", + "version": "5.3.1", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 797c47d577464c8240b13d2867fcbe52ce190722 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 29 Jul 2021 11:50:35 +0200 Subject: [PATCH 57/96] Bumps clean-css dependency to version 5.1.4. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 2e4a82d..264dcbc 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.3.2 / 2021-07-29](https://github.com/clean-css/clean-css-cli/compare/v5.3.1...5.3) +================== + +* Bumps clean-css dependency to 5.1.4. + [5.3.1 / 2021-07-29](https://github.com/clean-css/clean-css-cli/compare/v5.3.0...v5.3.1) ================== diff --git a/package-lock.json b/package-lock.json index 37e8269..592d144 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.3.tgz", - "integrity": "sha512-qGXzUCDpLwAlPx0kYeU4QXjzQIcIYZbJjD4FNm7NnSjoP0hYMVZhHOpUYJ6AwfkMX2cceLRq54MeCgHy/va1cA==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.4.tgz", + "integrity": "sha512-e6JAuR0T2ahg7fOSv98Nxqh7mHWOac5TaCSgrr61h/6mkPLwlxX38hzob4h6IKj/UHlrrLXvAEjWqXlvi8r8lQ==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index e99aa52..8ca6911 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { - "clean-css": "5.1.3", + "clean-css": "^5.1.4", "commander": "7.x", "glob": "^7.1.6" }, From 82561b3a15c1b9bfece5520ff2c31677d8434a98 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 29 Jul 2021 11:51:18 +0200 Subject: [PATCH 58/96] Version 5.3.2. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 264dcbc..3157e4c 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.3.2 / 2021-07-29](https://github.com/clean-css/clean-css-cli/compare/v5.3.1...5.3) +[5.3.2 / 2021-07-29](https://github.com/clean-css/clean-css-cli/compare/v5.3.1...v5.3.2) ================== * Bumps clean-css dependency to 5.1.4. diff --git a/package-lock.json b/package-lock.json index 592d144..31686cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.1", + "version": "5.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8ca6911..f0ee549 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.1", + "version": "5.3.2", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 130e39332e83e536e561e542664c4be7c9e2c2f9 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 5 Aug 2021 14:36:16 +0200 Subject: [PATCH 59/96] Bumps clean-css dependency to version 5.1.5. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 3157e4c..0db69ba 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.3.3 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.3.2...5.3) +================== + +* Bumps clean-css dependency to 5.1.5. + [5.3.2 / 2021-07-29](https://github.com/clean-css/clean-css-cli/compare/v5.3.1...v5.3.2) ================== diff --git a/package-lock.json b/package-lock.json index 31686cd..a28a628 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.4.tgz", - "integrity": "sha512-e6JAuR0T2ahg7fOSv98Nxqh7mHWOac5TaCSgrr61h/6mkPLwlxX38hzob4h6IKj/UHlrrLXvAEjWqXlvi8r8lQ==", + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.5.tgz", + "integrity": "sha512-9dr/cU/LjMpU57PXlSvDkVRh0rPxJBXiBtD0+SgYt8ahTCsXtfKjCkNYgIoTC6mBg8CFr5EKhW3DKCaGMUbUfQ==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index f0ee549..3f766a9 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { - "clean-css": "^5.1.4", + "clean-css": "^5.1.5", "commander": "7.x", "glob": "^7.1.6" }, From 13ee775da5f4f9148318a5347b4756515a982e3d Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 5 Aug 2021 14:36:58 +0200 Subject: [PATCH 60/96] Version 5.3.3. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 0db69ba..41f7f73 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.3.3 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.3.2...5.3) +[5.3.3 / 2021-08-05](https://github.com/clean-css/clean-css-cli/compare/v5.3.2...v5.3.3) ================== * Bumps clean-css dependency to 5.1.5. diff --git a/package-lock.json b/package-lock.json index a28a628..86af45e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.2", + "version": "5.3.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3f766a9..238b15b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.2", + "version": "5.3.3", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From da0f2b1656e68bae35e9818328faa6e6456d6c53 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 30 Sep 2021 15:03:37 +0200 Subject: [PATCH 61/96] Automatically run builds on all branches. --- .github/workflows/node.js.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a6505c6..c13795c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -3,11 +3,7 @@ name: x86 Linux build -on: - push: - branches: [master] - pull_request: - branches: [master] +on: [push, pull_request] jobs: build: From 07e292d5cb46407591540956570bd95e065a33c3 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 30 Sep 2021 15:00:39 +0200 Subject: [PATCH 62/96] Bumps clean-css dependency to version 5.2.0. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 41f7f73..82935b0 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.4.0 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/5.3...HEAD) +================== + +* Bumps clean-css dependency to 5.2.0. + [5.3.3 / 2021-08-05](https://github.com/clean-css/clean-css-cli/compare/v5.3.2...v5.3.3) ================== diff --git a/package-lock.json b/package-lock.json index 86af45e..45b105c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.5.tgz", - "integrity": "sha512-9dr/cU/LjMpU57PXlSvDkVRh0rPxJBXiBtD0+SgYt8ahTCsXtfKjCkNYgIoTC6mBg8CFr5EKhW3DKCaGMUbUfQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.0.tgz", + "integrity": "sha512-2639sWGa43EMmG7fn8mdVuBSs6HuWaSor+ZPoFWzenBc6oN+td8YhTfghWXZ25G1NiiSvz8bOFBS7PdSbTiqEA==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 238b15b..ee72c46 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { - "clean-css": "^5.1.5", + "clean-css": "5.2.0", "commander": "7.x", "glob": "^7.1.6" }, From 9e490fd0bd913a6581f8228f132ba3167d3aa192 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 30 Sep 2021 15:01:32 +0200 Subject: [PATCH 63/96] Version 5.4.0. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 82935b0..4845028 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.4.0 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/5.3...HEAD) +[5.4.0 / 2021-09-30](https://github.com/clean-css/clean-css-cli/compare/5.3...v5.4.0) ================== * Bumps clean-css dependency to 5.2.0. diff --git a/package-lock.json b/package-lock.json index 45b105c..6f8e67a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.3", + "version": "5.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ee72c46..859d274 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.3", + "version": "5.4.0", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 2d1c82330c3c291d567484c073ca14f9d4d1c7c7 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 30 Sep 2021 15:07:51 +0200 Subject: [PATCH 64/96] Bumps clean-css dependency to version 5.2.1. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 4845028..9a68864 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.4.1 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.4.0...5.4) +================== + +* Bumps clean-css dependency to 5.2.1. + [5.4.0 / 2021-09-30](https://github.com/clean-css/clean-css-cli/compare/5.3...v5.4.0) ================== diff --git a/package-lock.json b/package-lock.json index 6f8e67a..42e2552 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.0.tgz", - "integrity": "sha512-2639sWGa43EMmG7fn8mdVuBSs6HuWaSor+ZPoFWzenBc6oN+td8YhTfghWXZ25G1NiiSvz8bOFBS7PdSbTiqEA==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.1.tgz", + "integrity": "sha512-ooQCa1/70oRfVdUUGjKpbHuxgMgm8BsDT5EBqBGvPxMoRoGXf4PNx5mMnkjzJ9Ptx4vvmDdha0QVh86QtYIk1g==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 859d274..2993a20 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { - "clean-css": "5.2.0", + "clean-css": "^5.2.1", "commander": "7.x", "glob": "^7.1.6" }, From d896f60632604f17014924c2efab823d53d6a5b4 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 30 Sep 2021 15:08:26 +0200 Subject: [PATCH 65/96] Version 5.4.1. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 9a68864..606aeda 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.4.1 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.4.0...5.4) +[5.4.1 / 2021-09-30](https://github.com/clean-css/clean-css-cli/compare/v5.4.0...v5.4.1) ================== * Bumps clean-css dependency to 5.2.1. diff --git a/package-lock.json b/package-lock.json index 42e2552..daa8c8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.4.0", + "version": "5.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2993a20..bbc7a66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.4.0", + "version": "5.4.1", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 6f3f18807689b8444256913702baa5829f5d6388 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 21 Oct 2021 11:53:52 +0200 Subject: [PATCH 66/96] Bumps clean-css dependency to version 5.2.2. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 606aeda..45a7b63 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.4.2 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.4.1...5.4) +================== + +* Bumps clean-css dependency to 5.2.2. + [5.4.1 / 2021-09-30](https://github.com/clean-css/clean-css-cli/compare/v5.4.0...v5.4.1) ================== diff --git a/package-lock.json b/package-lock.json index daa8c8c..c7269ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "clean-css": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.1.tgz", - "integrity": "sha512-ooQCa1/70oRfVdUUGjKpbHuxgMgm8BsDT5EBqBGvPxMoRoGXf4PNx5mMnkjzJ9Ptx4vvmDdha0QVh86QtYIk1g==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.2.tgz", + "integrity": "sha512-/eR8ru5zyxKzpBLv9YZvMXgTSSQn7AdkMItMYynsFgGwTveCRVam9IUPFloE85B4vAIj05IuKmmEoV7/AQjT0w==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index bbc7a66..fe467e8 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { - "clean-css": "^5.2.1", + "clean-css": "^5.2.2", "commander": "7.x", "glob": "^7.1.6" }, From 3b4dd2007cefd3043987b5fa2b6027304903d3f4 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 21 Oct 2021 11:54:46 +0200 Subject: [PATCH 67/96] Version 5.4.2. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 45a7b63..7f4be13 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.4.2 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.4.1...5.4) +[5.4.2 / 2021-10-21](https://github.com/clean-css/clean-css-cli/compare/v5.4.1...v5.4.2) ================== * Bumps clean-css dependency to 5.2.2. diff --git a/package-lock.json b/package-lock.json index c7269ac..5e3808f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.4.1", + "version": "5.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fe467e8..70c88f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.4.1", + "version": "5.4.2", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 019c031c1932bd4abb7c3f04347c92a61ec38044 Mon Sep 17 00:00:00 2001 From: Christian Kozalla Date: Wed, 8 Dec 2021 13:32:03 +0100 Subject: [PATCH 68/96] Add feature --watch by including chokidar (#71) * Add feature --watch by including chokidar Check if the watch flag has been passed Construct an array of expanded file paths in case it is a batched command Load chokidar, pass input paths to its watch method Pass minify(...) as a callback to chokidars onchange method --- index.js | 13 +++++- package-lock.json | 111 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 123 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b207447..171b779 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,8 @@ function cli(process, beforeMinifyCallback) { .option('--remove-inlined-files', 'Remove files inlined in or via `@import` statements') .option('--source-map', 'Enables building input\'s source map') .option('--source-map-inline-sources', 'Enables inlining sources inside source maps') - .option('--with-rebase', 'Enable URLs rebasing'); + .option('--with-rebase', 'Enable URLs rebasing') + .option('--watch', 'Runs CLI in watch mode'); program.on('--help', function () { console.log(''); @@ -144,7 +145,15 @@ function cli(process, beforeMinifyCallback) { // ... and do the magic! if (program.args.length > 0) { - minify(process, options, configurations, expandGlobs(program.args)); + var expandedGlobs = expandGlobs(program.args); + if (inputOptions.watch) { + var inputPaths = expandedGlobs.map(function (path) { return path.expanded; }); + require('chokidar').watch(inputPaths).on('change', function () { + minify(process, options, configurations, expandedGlobs); + }); + } else { + minify(process, options, configurations, expandedGlobs); + } } else { stdin = process.openStdin(); stdin.setEncoding('utf-8'); diff --git a/package-lock.json b/package-lock.json index 5e3808f..15deb08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,11 +4,25 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -18,6 +32,29 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "clean-css": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.2.tgz", @@ -153,6 +190,14 @@ "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=", "dev": true }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, "follow-redirects": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", @@ -164,6 +209,12 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -177,6 +228,14 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, "htmlparser2": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", @@ -215,6 +274,32 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", @@ -251,6 +336,11 @@ "brace-expansion": "^1.1.7" } }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -264,6 +354,11 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==" + }, "readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -276,6 +371,14 @@ "string_decoder": "~0.10.x" } }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "requires": { + "picomatch": "^2.2.1" + } + }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -306,6 +409,14 @@ "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", "dev": true }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, "vows": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/vows/-/vows-0.8.3.tgz", diff --git a/package.json b/package.json index 70c88f3..65176d4 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ ], "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { + "chokidar": "^3.5.2", "clean-css": "^5.2.2", "commander": "7.x", "glob": "^7.1.6" From 714b1cb69743defe506ead58ac586e21d03f3c29 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 8 Dec 2021 13:59:48 +0100 Subject: [PATCH 69/96] When in watch mode run all optimizations on the first run. --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 171b779..a88e6c7 100644 --- a/index.js +++ b/index.js @@ -148,6 +148,8 @@ function cli(process, beforeMinifyCallback) { var expandedGlobs = expandGlobs(program.args); if (inputOptions.watch) { var inputPaths = expandedGlobs.map(function (path) { return path.expanded; }); + + minify(process, options, configurations, expandedGlobs); require('chokidar').watch(inputPaths).on('change', function () { minify(process, options, configurations, expandedGlobs); }); From 8e8e990d182652aeeca7b36d10490430c1ef19f0 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 8 Dec 2021 14:05:59 +0100 Subject: [PATCH 70/96] Prints a message to standard output whenever a watched file changes. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a88e6c7..ac1667c 100644 --- a/index.js +++ b/index.js @@ -150,7 +150,8 @@ function cli(process, beforeMinifyCallback) { var inputPaths = expandedGlobs.map(function (path) { return path.expanded; }); minify(process, options, configurations, expandedGlobs); - require('chokidar').watch(inputPaths).on('change', function () { + require('chokidar').watch(inputPaths).on('change', function (pathToChangedFile) { + console.log(`File '${pathToChangedFile}' has changed. Rerunning all optimizations...`) minify(process, options, configurations, expandedGlobs); }); } else { From 0898802fbc8ba36490827da6e1ba6156ca17781d Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 8 Dec 2021 14:09:04 +0100 Subject: [PATCH 71/96] Adds changelog entry for `--watch` switch. --- History.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/History.md b/History.md index 7f4be13..35b484f 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.5.0 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/5.4...HEAD) +================== + +* Adds a new `--watch` switch, which makes CLI re-run optimizations when watched file(s) change. + [5.4.2 / 2021-10-21](https://github.com/clean-css/clean-css-cli/compare/v5.4.1...v5.4.2) ================== From 091f281436ee8bac862c073f56340ff919d56a38 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 8 Dec 2021 14:10:37 +0100 Subject: [PATCH 72/96] Adds version 5.5 entry to readme. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f7f8b49..fa1fe1b 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0. - [Node.js version support](#nodejs-version-support) - [Install](#install) - [Use](#use) + * [What's new in version 5.5](#whats-new-in-version-55) * [What's new in version 5.1](#whats-new-in-version-51) * [What's new in version 5.0](#whats-new-in-version-50) * [What's new in version 4.3](#whats-new-in-version-43) @@ -61,6 +62,12 @@ Note: Global install via -g option is recommended unless you want to execute the cleancss -o one.min.css one.css ``` +## What's new in version 5.5 + +clean-css-cli 5.5 introduces the following changes / features: + +* adds a new `--watch` switch, which makes `cleancss` re-run optimizations when watched file(s) change. + ## What's new in version 5.1 clean-css-cli 5.1 introduces the following changes / features: From 79f49dd4fe35cc5e988838d38cd4fe4e3a1fc786 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 8 Dec 2021 14:11:58 +0100 Subject: [PATCH 73/96] Fixes linter errors. --- .jshintrc | 1 + index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index 5d47cc8..a546a1f 100644 --- a/.jshintrc +++ b/.jshintrc @@ -2,6 +2,7 @@ "camelcase": true, "curly": false, "eqeqeq": false, + "esversion": 6, "immed": true, "indent": 2, "noarg": true, diff --git a/index.js b/index.js index ac1667c..07ef5b6 100644 --- a/index.js +++ b/index.js @@ -151,7 +151,7 @@ function cli(process, beforeMinifyCallback) { minify(process, options, configurations, expandedGlobs); require('chokidar').watch(inputPaths).on('change', function (pathToChangedFile) { - console.log(`File '${pathToChangedFile}' has changed. Rerunning all optimizations...`) + console.log(`File '${pathToChangedFile}' has changed. Rerunning all optimizations...`); minify(process, options, configurations, expandedGlobs); }); } else { From 723b3c8063384aebbac1aeb060c76806c09b2a29 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 8 Dec 2021 15:46:05 +0100 Subject: [PATCH 74/96] Version 5.5.0. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 35b484f..7d2dd59 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.5.0 / 2021-xx-xx](https://github.com/clean-css/clean-css-cli/compare/5.4...HEAD) +[5.5.0 / 2021-12-08](https://github.com/clean-css/clean-css-cli/compare/5.4...v5.5.0) ================== * Adds a new `--watch` switch, which makes CLI re-run optimizations when watched file(s) change. diff --git a/package-lock.json b/package-lock.json index 15deb08..5317737 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.4.2", + "version": "5.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 65176d4..a6924ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.4.2", + "version": "5.5.0", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 6ae08d02377fc7f1e60841fdf7d6e5833affb666 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 26 Jan 2022 13:01:46 +0100 Subject: [PATCH 75/96] Bumps clean-css dependency to v5.2.3. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 7d2dd59..58e5083 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.5.1 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.5.0...5.5) +================== + +* Bumps clean-css dependency to 5.2.3. + [5.5.0 / 2021-12-08](https://github.com/clean-css/clean-css-cli/compare/5.4...v5.5.0) ================== diff --git a/package-lock.json b/package-lock.json index 5317737..1f80c2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,9 +56,9 @@ } }, "clean-css": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.2.tgz", - "integrity": "sha512-/eR8ru5zyxKzpBLv9YZvMXgTSSQn7AdkMItMYynsFgGwTveCRVam9IUPFloE85B4vAIj05IuKmmEoV7/AQjT0w==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.3.tgz", + "integrity": "sha512-qjywD7LvpZJ5+E16lf00GnMVUX5TEVBcKW1/vtGPgAerHwRwE4JP4p1Y40zbLnup2ZfWsd30P2bHdoAKH93XxA==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index a6924ff..fcafa7d 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { "chokidar": "^3.5.2", - "clean-css": "^5.2.2", + "clean-css": "^5.2.3", "commander": "7.x", "glob": "^7.1.6" }, From 384dbb036b57b11d7dd86bcf64414afd025433e1 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 26 Jan 2022 13:02:27 +0100 Subject: [PATCH 76/96] Version 5.5.1. --- History.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index 58e5083..6c296dd 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.5.1 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.5.0...5.5) +[5.5.1 / 2022-01-26](https://github.com/clean-css/clean-css-cli/compare/v5.5.0...v5.5.1) ================== * Bumps clean-css dependency to 5.2.3. diff --git a/package.json b/package.json index fcafa7d..6f0ba05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.5.0", + "version": "5.5.1", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 4676f37af9de9ed0d4bd8ffc1cc15d68473c5ce8 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 26 Jan 2022 13:53:58 +0100 Subject: [PATCH 77/96] Removes sponsorship info. --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index d11d019..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: [jakubpawlowicz] From a9104a728d016d9531cdd7386967b409b0c08d19 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 28 Jan 2022 17:11:17 +0100 Subject: [PATCH 78/96] Bumps clean-css to version 5.2.4. --- History.md | 5 +++++ package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/History.md b/History.md index 6c296dd..fa82c24 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.5.2 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.5.1...5.5) +================== + +* Bumps clean-css dependency to 5.2.4. + [5.5.1 / 2022-01-26](https://github.com/clean-css/clean-css-cli/compare/v5.5.0...v5.5.1) ================== diff --git a/package-lock.json b/package-lock.json index 1f80c2d..3e02d42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.5.0", + "version": "5.5.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -56,9 +56,9 @@ } }, "clean-css": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.3.tgz", - "integrity": "sha512-qjywD7LvpZJ5+E16lf00GnMVUX5TEVBcKW1/vtGPgAerHwRwE4JP4p1Y40zbLnup2ZfWsd30P2bHdoAKH93XxA==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.4.tgz", + "integrity": "sha512-nKseG8wCzEuji/4yrgM/5cthL9oTDc5UOQyFMvW/Q53oP6gLH690o1NbuTh6Y18nujr7BxlsFuS7gXLnLzKJGg==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 6f0ba05..047be8c 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { "chokidar": "^3.5.2", - "clean-css": "^5.2.3", + "clean-css": "^5.2.4", "commander": "7.x", "glob": "^7.1.6" }, From 397323798fc945a94ec393f9a442ffaa869b1473 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 28 Jan 2022 17:12:07 +0100 Subject: [PATCH 79/96] Version 5.5.2. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index fa82c24..45e8e9d 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.5.2 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.5.1...5.5) +[5.5.2 / 2022-01-28](https://github.com/clean-css/clean-css-cli/compare/v5.5.1...v5.5.2) ================== * Bumps clean-css dependency to 5.2.4. diff --git a/package-lock.json b/package-lock.json index 3e02d42..70fbe11 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.5.1", + "version": "5.5.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 047be8c..fbda8d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.5.1", + "version": "5.5.2", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 0033ad843519810700994c895527f85d0e489d57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Mar 2022 10:59:38 +0100 Subject: [PATCH 80/96] Bump follow-redirects from 1.13.0 to 1.14.8 (#74) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.13.0 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.13.0...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 70fbe11..98c5e19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -199,9 +199,9 @@ } }, "follow-redirects": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", - "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==", + "version": "1.14.8", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", + "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==", "dev": true }, "fs.realpath": { From 7ec2c5d5ca6cfb1f48ef6873b227e17428a2ca0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:00:02 +0100 Subject: [PATCH 81/96] Bump lodash from 4.17.20 to 4.17.21 (#69) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 98c5e19..d3575f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -323,9 +323,9 @@ } }, "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "minimatch": { From 838eb339521376735b0f6d1738f4334565966e84 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 31 Mar 2022 14:02:08 +0200 Subject: [PATCH 82/96] Updates `jshint` to version 2.13.x. It solves 2 security advisories we had. --- package-lock.json | 27 ++++++++++----------------- package.json | 2 +- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3575f1..4c29809 100644 --- a/package-lock.json +++ b/package-lock.json @@ -100,9 +100,9 @@ } }, "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, "date-now": { @@ -128,9 +128,9 @@ }, "dependencies": { "domelementtype": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz", - "integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", "dev": true }, "entities": { @@ -307,18 +307,17 @@ "dev": true }, "jshint": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.12.0.tgz", - "integrity": "sha512-TwuuaUDmra0JMkuqvqy+WGo2xGHSNjv1BA1nTIgtH2K5z1jHuAEeAgp7laaR+hLRmajRjcrM71+vByBDanCyYA==", + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.13.4.tgz", + "integrity": "sha512-HO3bosL84b2qWqI0q+kpT/OpRJwo0R4ivgmxaO848+bo10rc50SkPnrtwSFXttW0ym4np8jbJvLwk5NziB7jIw==", "dev": true, "requires": { "cli": "~1.0.0", "console-browserify": "1.1.x", "exit": "0.1.x", "htmlparser2": "3.8.x", - "lodash": "~4.17.19", + "lodash": "~4.17.21", "minimatch": "~3.0.2", - "shelljs": "0.3.x", "strip-json-comments": "1.0.x" } }, @@ -385,12 +384,6 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "dev": true }, - "shelljs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", - "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", - "dev": true - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", diff --git a/package.json b/package.json index fbda8d5..003d706 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ }, "devDependencies": { "http-proxy": "1.x", - "jshint": "^2.12.0", + "jshint": "^2.13.0", "source-map": "0.5.x", "vows": "^0.8.3" }, From 07d02ea80ca7f6dd95b2dc5a6162e712d72759e6 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 31 Mar 2022 14:03:29 +0200 Subject: [PATCH 83/96] Updates clean-css dependency to version 5.3.0. --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c29809..9a3d5c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,9 +56,9 @@ } }, "clean-css": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.4.tgz", - "integrity": "sha512-nKseG8wCzEuji/4yrgM/5cthL9oTDc5UOQyFMvW/Q53oP6gLH690o1NbuTh6Y18nujr7BxlsFuS7gXLnLzKJGg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.0.tgz", + "integrity": "sha512-YYuuxv4H/iNb1Z/5IbMRoxgrzjWGhOEFfd+groZ5dMCVkpENiMZmwspdrzBo9286JjM1gZJPAyL7ZIdzuvu2AQ==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index 003d706..0daedc6 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { "chokidar": "^3.5.2", - "clean-css": "^5.2.4", + "clean-css": "^5.3.0", "commander": "7.x", "glob": "^7.1.6" }, From 8353b62df69d2a621c677e840a638dbe913ce0e7 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 31 Mar 2022 14:05:07 +0200 Subject: [PATCH 84/96] Fixes tests after clean-css 5.3.0 upgrade. --- test/fixtures/unsupported/selectors-ie7.css | 4 ++-- test/fixtures/unsupported/selectors-ie8.css | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fixtures/unsupported/selectors-ie7.css b/test/fixtures/unsupported/selectors-ie7.css index 3f2fc3e..29350f2 100644 --- a/test/fixtures/unsupported/selectors-ie7.css +++ b/test/fixtures/unsupported/selectors-ie7.css @@ -2,14 +2,14 @@ p:focus{top:0} p:before{top:0} p:after{top:0} p:root{top:0} -p:nth-of-type(1){top:0} +p:first-of-type{top:0} p:nth-last-of-type(1){top:0} p:first-of-type{top:0} p:last-of-type{top:0} p:only-of-type{top:0} p:only-child{top:0} p:last-child{top:0} -p:nth-child(1){top:0} +p:first-child{top:0} p:nth-last-child(1){top:0} p:empty{top:0} p:target{top:0} diff --git a/test/fixtures/unsupported/selectors-ie8.css b/test/fixtures/unsupported/selectors-ie8.css index 2d01251..94df693 100644 --- a/test/fixtures/unsupported/selectors-ie8.css +++ b/test/fixtures/unsupported/selectors-ie8.css @@ -1,12 +1,12 @@ p:root{top:0} -p:nth-of-type(1){top:0} +p:first-of-type{top:0} p:nth-last-of-type(1){top:0} p:first-of-type{top:0} p:last-of-type{top:0} p:only-of-type{top:0} p:only-child{top:0} p:last-child{top:0} -p:nth-child(1){top:0} +p:first-child{top:0} p:nth-last-child(1){top:0} p:empty{top:0} p:target{top:0} From 3281a7457f1be7e5e590aba76ef04853131ee164 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 31 Mar 2022 14:07:28 +0200 Subject: [PATCH 85/96] Updates changelog after clean-css 5.3.0 upgrade. --- History.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/History.md b/History.md index 45e8e9d..c479fc2 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.6.0 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.5.2...5.6) +================== + +* Bumps clean-css dependency to 5.3.0. + [5.5.2 / 2022-01-28](https://github.com/clean-css/clean-css-cli/compare/v5.5.1...v5.5.2) ================== From 1a1176c56997cb49b8498133e30967ef3b5efb04 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 31 Mar 2022 14:08:44 +0200 Subject: [PATCH 86/96] Version 5.6.0. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index c479fc2..fb7e7ef 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.6.0 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.5.2...5.6) +[5.6.0 / 2022-03-31](https://github.com/clean-css/clean-css-cli/compare/v5.5.2...v5.6.0) ================== * Bumps clean-css dependency to 5.3.0. diff --git a/package-lock.json b/package-lock.json index 9a3d5c6..76997f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.5.2", + "version": "5.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0daedc6..f26fff8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.5.2", + "version": "5.6.0", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From c170f43d8e884b9033d8e0c7bcc294dbcc823dd9 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 31 Mar 2022 14:11:13 +0200 Subject: [PATCH 87/96] Adds maintenance mode info in readme. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fa1fe1b..49a7a9f 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ clean-css-cli is a command-line interface to [clean-css](https://github.com/jaku Previously a part of clean-css it's a separate package since clean-css 4.0. +__IMPORTANT: clean-css-cli is now in a [maintenance mode](https://github.com/clean-css/clean-css-cli/discussions/76). PRs are still welcome, and I will try do an occasional bugfix relase.__ + **Table of Contents** - [Node.js version support](#nodejs-version-support) From dab79dbc27897ab23d430f267b6c4c3cb5b1d947 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 13 Jul 2022 11:39:10 +0200 Subject: [PATCH 88/96] Updates clean-css dependency to version 5.3.1. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- test/fixtures/unsupported/selectors-ie7.css | 4 ++-- test/fixtures/unsupported/selectors-ie8.css | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/History.md b/History.md index fb7e7ef..2d9bf31 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.6.1 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.6.0...5.6) +================== + +* Bumps clean-css dependency to 5.3.1. + [5.6.0 / 2022-03-31](https://github.com/clean-css/clean-css-cli/compare/v5.5.2...v5.6.0) ================== diff --git a/package-lock.json b/package-lock.json index 76997f4..fc57a10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,9 +56,9 @@ } }, "clean-css": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.0.tgz", - "integrity": "sha512-YYuuxv4H/iNb1Z/5IbMRoxgrzjWGhOEFfd+groZ5dMCVkpENiMZmwspdrzBo9286JjM1gZJPAyL7ZIdzuvu2AQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.1.tgz", + "integrity": "sha512-lCr8OHhiWCTw4v8POJovCoh4T7I9U11yVsPjMWWnnMmp9ZowCxyad1Pathle/9HjaDp+fdQKjO9fQydE6RHTZg==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index f26fff8..3b7be6f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { "chokidar": "^3.5.2", - "clean-css": "^5.3.0", + "clean-css": "^5.3.1", "commander": "7.x", "glob": "^7.1.6" }, diff --git a/test/fixtures/unsupported/selectors-ie7.css b/test/fixtures/unsupported/selectors-ie7.css index 29350f2..d43708e 100644 --- a/test/fixtures/unsupported/selectors-ie7.css +++ b/test/fixtures/unsupported/selectors-ie7.css @@ -3,14 +3,14 @@ p:before{top:0} p:after{top:0} p:root{top:0} p:first-of-type{top:0} -p:nth-last-of-type(1){top:0} +p:last-of-type{top:0} p:first-of-type{top:0} p:last-of-type{top:0} p:only-of-type{top:0} p:only-child{top:0} p:last-child{top:0} p:first-child{top:0} -p:nth-last-child(1){top:0} +p:last-child{top:0} p:empty{top:0} p:target{top:0} p:checked{top:0} diff --git a/test/fixtures/unsupported/selectors-ie8.css b/test/fixtures/unsupported/selectors-ie8.css index 94df693..fb8a104 100644 --- a/test/fixtures/unsupported/selectors-ie8.css +++ b/test/fixtures/unsupported/selectors-ie8.css @@ -1,13 +1,13 @@ p:root{top:0} p:first-of-type{top:0} -p:nth-last-of-type(1){top:0} +p:last-of-type{top:0} p:first-of-type{top:0} p:last-of-type{top:0} p:only-of-type{top:0} p:only-child{top:0} p:last-child{top:0} p:first-child{top:0} -p:nth-last-child(1){top:0} +p:last-child{top:0} p:empty{top:0} p:target{top:0} p:checked{top:0} From 8fc585e99d7bf4e812a5d4444ccbaf9967f24f10 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 13 Jul 2022 11:44:27 +0200 Subject: [PATCH 89/96] Version 5.6.1. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 2d9bf31..1c8e4f6 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.6.1 / 2022-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.6.0...5.6) +[5.6.1 / 2022-07-13](https://github.com/clean-css/clean-css-cli/compare/v5.6.0...v5.6.1) ================== * Bumps clean-css dependency to 5.3.1. diff --git a/package-lock.json b/package-lock.json index fc57a10..971e21b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.6.0", + "version": "5.6.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3b7be6f..bbd6bc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.6.0", + "version": "5.6.1", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From 5ff9178bceb23597f178f6bb74c6216a433e56d3 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 19 Jan 2023 11:17:20 +0100 Subject: [PATCH 90/96] Updates clean-css dependency to version 5.3.2. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 1c8e4f6..5283c22 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.6.2 / 2023-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.6.1...5.6) +================== + +* Bumps clean-css dependency to 5.3.2 + [5.6.1 / 2022-07-13](https://github.com/clean-css/clean-css-cli/compare/v5.6.0...v5.6.1) ================== diff --git a/package-lock.json b/package-lock.json index 971e21b..b131152 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,9 +56,9 @@ } }, "clean-css": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.1.tgz", - "integrity": "sha512-lCr8OHhiWCTw4v8POJovCoh4T7I9U11yVsPjMWWnnMmp9ZowCxyad1Pathle/9HjaDp+fdQKjO9fQydE6RHTZg==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.2.tgz", + "integrity": "sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index bbd6bc4..3fde730 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { "chokidar": "^3.5.2", - "clean-css": "^5.3.1", + "clean-css": "^5.3.2", "commander": "7.x", "glob": "^7.1.6" }, From d4453d880c92aa62e823832fa6115d57f0804e60 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 11:21:28 +0100 Subject: [PATCH 91/96] Bump minimatch from 3.0.4 to 3.0.8 (#84) Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.0.8. - [Release notes](https://github.com/isaacs/minimatch/releases) - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md) - [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.0.8) --- updated-dependencies: - dependency-name: minimatch dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b131152..e08113d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -319,6 +319,17 @@ "lodash": "~4.17.21", "minimatch": "~3.0.2", "strip-json-comments": "1.0.x" + }, + "dependencies": { + "minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "lodash": { @@ -328,9 +339,9 @@ "dev": true }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } From 0ff25fb6e20a24078b5df11163edece5c3d20fed Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 19 Jan 2023 11:19:49 +0100 Subject: [PATCH 92/96] Version 5.6.2. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 5283c22..897a17d 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.6.2 / 2023-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.6.1...5.6) +[5.6.2 / 2023-01-19](https://github.com/clean-css/clean-css-cli/compare/v5.6.1...v5.6.2) ================== * Bumps clean-css dependency to 5.3.2 diff --git a/package-lock.json b/package-lock.json index e08113d..a7a3aa2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.6.1", + "version": "5.6.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3fde730..a2aee83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.6.1", + "version": "5.6.2", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", From a55daf089ae1ea240d36b9aa472d9b0fb89d1a84 Mon Sep 17 00:00:00 2001 From: SuperStormer <41648788+SuperStormer@users.noreply.github.com> Date: Wed, 15 Mar 2023 04:30:32 -0400 Subject: [PATCH 93/96] fix #80 (#86) --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 07ef5b6..bfd06df 100644 --- a/index.js +++ b/index.js @@ -100,6 +100,7 @@ function cli(process, beforeMinifyCallback) { if (program.rawArgs.indexOf('-O0') > -1) { options.level[0] = true; + options.level[1] = false; } if (program.rawArgs.indexOf('-O1') > -1) { From dfe93e3c2dbfcaf951e3c3b31be3ac7de8016e94 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 15 Mar 2023 09:31:56 +0100 Subject: [PATCH 94/96] Adds a testcase for #86. --- test/binary-test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/binary-test.js b/test/binary-test.js index 65d6673..d9848e2 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -156,6 +156,13 @@ vows.describe('cleancss') } }) }) + .addBatch({ + 'level 0 optimizations': pipedContext('a{color:#ff0000;margin:0 0 0 0}', '-O0', { + 'should skip all optimizations': function (error, stdout) { + assert.equal(stdout, 'a{color:#ff0000;margin:0 0 0 0}'); + } + }) + }) .addBatch({ 'enable restructuring optimizations': pipedContext('div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}', '-O2 restructureRules:on', { 'should do basic optimizations only': function (error, stdout) { From 33bccc0b67ad3e965f4080b9d6c2b10f937367d5 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 30 Nov 2023 10:17:25 +0100 Subject: [PATCH 95/96] Updates clean-css dependency to version 5.3.3. --- History.md | 5 +++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index 897a17d..6669907 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[5.6.3 / 2023-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.6.2...5.6) +================== + +* Bumps clean-css dependency to 5.3.3 + [5.6.2 / 2023-01-19](https://github.com/clean-css/clean-css-cli/compare/v5.6.1...v5.6.2) ================== diff --git a/package-lock.json b/package-lock.json index a7a3aa2..fbeedaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,9 +56,9 @@ } }, "clean-css": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.2.tgz", - "integrity": "sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", + "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", "requires": { "source-map": "~0.6.0" }, diff --git a/package.json b/package.json index a2aee83..366f734 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "homepage": "https://github.com/clean-css/clean-css-cli#readme", "dependencies": { "chokidar": "^3.5.2", - "clean-css": "^5.3.2", + "clean-css": "^5.3.3", "commander": "7.x", "glob": "^7.1.6" }, From bcf7086598a1550591819c7d3b4850e123f15144 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 30 Nov 2023 10:19:22 +0100 Subject: [PATCH 96/96] Version 5.6.3. --- History.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 6669907..5cbdfa9 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -[5.6.3 / 2023-xx-xx](https://github.com/clean-css/clean-css-cli/compare/v5.6.2...5.6) +[5.6.3 / 2023-11-30](https://github.com/clean-css/clean-css-cli/compare/v5.6.2...v5.6.3) ================== * Bumps clean-css dependency to 5.3.3 diff --git a/package-lock.json b/package-lock.json index fbeedaf..f06ecb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.6.2", + "version": "5.6.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 366f734..43f5572 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.6.2", + "version": "5.6.3", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .",