Terser is a free tool for compressing and/or mangling javascript files.
As far as I have understood, the tool relies on node.js, so that is a pre-req for running Terser in the first place.
This will execute the terser command on a single file:
terser input.js -c -m -o output.js
This is fine for some files that aren't updated frequently, but if you have a large set of Javascript files in your project that are updated instantly, you would appreciate something more dynamic.
I was thinking about including each file command inside a .bat file and execute that as one file, but I cannot get that to work: I tried placing these between the ECHO AND PAUSE commands in the bat file but it doesn't work well unfortunately.
As far as I have seen, the documentation covers just running terser as CLI
Is there a way to "move" the command lines from the CLI environment to the .bat file?
I encountered the same problem today as I was trying to use "terser" in batch files for the first time (instead of
uglify-es
I usedprecedently
)After each "terser" command the execution of the batch file stops
After adding a pipe
| pause
at the end of eachterser
command, my batch file runs as usual and executes the next commands.