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] 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: 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/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..5cbdfa9 100644 --- a/History.md +++ b/History.md @@ -1,175 +1,240 @@ -[5.3.0 / 2021-04-28](https://github.com/jakubpawlowicz/clean-css-cli/compare/5.2...v5.3.0) +[5.6.3 / 2023-11-30](https://github.com/clean-css/clean-css-cli/compare/v5.6.2...v5.6.3) ================== -* 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. +* Bumps clean-css dependency to 5.3.3 -[5.2.2 / 2021-03-19](https://github.com/jakubpawlowicz/clean-css-cli/compare/v5.2.1...v5.2.2) +[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 + +[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. + +[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. + +[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. + +[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. + +[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. + +[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. + +[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. + +[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. + +[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. + +[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. + +[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. + +[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/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/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 +243,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 af703b5..49a7a9f 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,22 @@ [![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/). 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) - [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 +64,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: @@ -238,10 +247,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. @@ -444,14 +453,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 +479,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/index.js b/index.js index b207447..bfd06df 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(''); @@ -99,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) { @@ -144,7 +146,18 @@ 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; }); + + minify(process, options, configurations, expandedGlobs); + require('chokidar').watch(inputPaths).on('change', function (pathToChangedFile) { + console.log(`File '${pathToChangedFile}' has changed. Rerunning all optimizations...`); + 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 6ed4897..f06ecb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,28 @@ { "name": "clean-css-cli", - "version": "5.3.0", + "version": "5.6.3", "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,10 +32,33 @@ "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.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.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" }, @@ -63,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": { @@ -91,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": { @@ -153,10 +190,18 @@ "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", - "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": { @@ -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", @@ -222,35 +307,50 @@ "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" + }, + "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": { - "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": { - "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" } }, + "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 +364,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,18 +381,20 @@ "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", "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", @@ -306,6 +413,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 79b9710..43f5572 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-css-cli", - "version": "5.3.0", + "version": "5.6.3", "description": "A command-line interface to clean-css CSS optimization library", "scripts": { "check": "jshint ./bin/cleancss .", @@ -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,15 +32,16 @@ "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", + "chokidar": "^3.5.2", + "clean-css": "^5.3.3", "commander": "7.x", "glob": "^7.1.6" }, "devDependencies": { "http-proxy": "1.x", - "jshint": "^2.12.0", + "jshint": "^2.13.0", "source-map": "0.5.x", "vows": "^0.8.3" }, 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) { diff --git a/test/fixtures/unsupported/selectors-ie7.css b/test/fixtures/unsupported/selectors-ie7.css index 3f2fc3e..d43708e 100644 --- a/test/fixtures/unsupported/selectors-ie7.css +++ b/test/fixtures/unsupported/selectors-ie7.css @@ -2,15 +2,15 @@ p:focus{top:0} p:before{top:0} p:after{top:0} p:root{top:0} -p:nth-of-type(1){top:0} -p:nth-last-of-type(1){top:0} +p:first-of-type{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:nth-child(1){top:0} -p:nth-last-child(1){top:0} +p:first-child{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 2d01251..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:nth-of-type(1){top:0} -p:nth-last-of-type(1){top:0} +p:first-of-type{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:nth-child(1){top:0} -p:nth-last-child(1){top:0} +p:first-child{top:0} +p:last-child{top:0} p:empty{top:0} p:target{top:0} p:checked{top:0}