Forrest logo
back to the watchexec tool

watchexec:tldr:e585d

watchexec: Run `make` when any JavaScript, CSS and HTML files in the current directory change.
$ watchexec --exts ${js,css,html} make
try on your machine

The given command is using the watchexec tool to monitor changes in files with specific extensions and then executing the make command whenever one of those files is modified.

Here is a breakdown of the command:

  • watchexec: This is the command to invoke the watchexec tool, which is a command-line utility for watching file changes and running arbitrary commands.
  • --exts ${js,css,html}: This option specifies the file extensions to watch for changes. In this case, it is set to .js, .css, and .html. The ${js,css,html} syntax is used to represent multiple file extensions separated by commas.
  • make: This is the command that will be executed whenever a change is detected in one of the specified files. In this case, it is the make command, which is typically used to build or compile a project.

So, when the watchexec tool is run with the given command, it will continuously monitor the specified file extensions (js, css, and html). Whenever a change occurs in any of those files, it will automatically trigger the make command, allowing you to rebuild or compile your project in response to the changes.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the watchexec tool