Add feature --watch by including chokidar#71
Add feature --watch by including chokidar#71jakubpawlowicz merged 3 commits intoclean-css:masterfrom christiankozalla:master
Conversation
christiankozalla
commented
Nov 22, 2021
- 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
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
Outdated
| if (program.args.length > 0) { | ||
| minify(process, options, configurations, expandGlobs(program.args)); | ||
| if (inputOptions.watch) { | ||
| var inputPaths = expandGlobs(program.args).map(function (path) { return path.expanded; }); |
There was a problem hiding this comment.
Since we use expandGlobs(program.args) three times here, should we extract it into a variable?
There was a problem hiding this comment.
I've extracted the call to expandGlobs() into a variable "expandedGlobs"
| { | ||
| "name": "clean-css-cli", | ||
| "version": "5.4.2", | ||
| "lockfileVersion": 1, |
There was a problem hiding this comment.
Can you perhaps regenerate this file with older NPM to minimize number of changes? We may update to lockfile v2 later.
There was a problem hiding this comment.
Alright, I've set the lockfile back to version 1 by using npm v6 in order to install chokidar. Sorry about that, upgrading to v2 was just a side-effect I have not foreseen while I was on npm v7
|
Otherwise looks good! |
|
👍 for changes - I'll pull the PR and give it a try locally before merging. If it's all good then we can release it. |
|
All looks good, let's merge it. |
|
Two comments for after merge:
|
|
Ok, it's done. Please let me know @christiankozalla if you want to add those two simple changes or should I. Thanks! |
|
Thank you for testing and merging! I believe it's better if you could add these two changes, because right now I am not able to do the work, because I lying in bed sick. Nothing severe though |
|
Gotcha, get well and many thanks for your contribution! |
|
And it's released in clean-css 5.5.0. Thanks! |