I'm trying to use UglifyJS in order to minify my code but I'm running into a bit of a problem. I have a file structure like so:
/deploy
/assets
/js
((minified file goes here))
/js
script-compiled.js
I want to run UglifyJS on js/script-compiled.js
located in my private folder and have it output a script.min.js
file in my deploy/js
(the js that gets uploaded to my website) folder. Here's what I have so far for my command:
uglifyjs js/script-compiled.js --compress --mangle --screw-ie8 -o > deploy/assets/js/script.min.js
Which gives me this error:
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string
I'm a little confused. Is it possible to output a file to a different directory? Maybe this is just a general Bash thing. Thanks!
You specified the
-o
option but you didn't provide a value. From the docs:So either do
or omit
-o
and redirect stdout