In this tutorial we will see how to pass arguments to a command when combining npm scripts.
Let’s assume we have the current script defined in our npm scripts:
Now let’s say we want to create a new task that will not only compile our stylus files to css but also watch for changes and recompile when necessary.
Using the command line this can be done with the
We now want to create a new script that watches for stylus changes. We can do:
See anything ugly ?
In order to avoid duplicated code, we want to reuse our first command and add the
The general syntax is
With our example it would be:
-- in between the initial command and the additional arguments.