So I am looping through files in a directory via Node and want to minify them with UglifyJs.
The API is dead easy for JavaScript files:
var UglifyJS = require("uglify-js")
// Looping here
UglifyJS.minify(listOfAllFiles[i])
However, the files I need to minify are JSON files, so this is producing an eval error. In the command line, if you are minifying JSON, you just pass --expr and it will evaluate as a single expression. Any idea how to pass this into the options object of the JavaScript API?
Cheers.
exprparameter in it's documentation.