-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cli] Add new options to watcher #173
base: main
Are you sure you want to change the base?
Conversation
- add `--poll` / `-p` option for polling - add `--ignored` / `-i` option for ignoring specified paths - add some default options for watcher based on config used in `tailwindcss`
|
watch(filesPattern, { persistent: false }) | ||
.on("add", (path) => { | ||
.option( | ||
"-p, --poll", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are those -p
and -i
shortcuts matching the Tailwind CLI? Personally, I would not introduce those as we might add some other options in the future and they might be better suited for having those shortcuts (this feels especial;y true about -p
)
.on("add", (path) => { | ||
.option( | ||
"-p, --poll", | ||
"Use polling instead of filesystem events when watching" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any specific reason to prefer this in certain situations?
ignored, | ||
usePolling: shouldPoll, | ||
interval: shouldPoll ? pollInterval : undefined, | ||
ignoreInitial: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one has been added, right? could you elaborate on why you think it's needed? what kind of issues this can help us avoid?
stabilityThreshold: 50, | ||
pollInterval: pollInterval, | ||
} | ||
: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously we were using true
here at all times - any particular reason why this has been changed?
What
--poll
/-p
option for polling--ignored
/-i
option for ignoring specified pathstailwindcss
Why
--poll
optionIt was easy to add and maybe someone will need that
--ignored
optionThis might be useful for big projects / monorepos. Someone might want to ignore
node_modules
directory. My case was slightly different. Due to unexpected behavior ofchokidar
lib on Windows, I had to ignore some additional paths. Nevertheless, the case is still valid :)Additional options
This was copied from https://github.com/tailwindlabs/tailwindcss/blob/60a0ae20176604b9444f95b09cbb1f549702a143/src/cli.js#L846-L854. Since
tailwind
is widely used, I assumed those settings might serve as nice defaults.Thank you for your time.