UglifyJS - 如何输出到不同的文件夹?
UglifyJS - how to output to a different folder?
我正在尝试使用 UglifyJS 来缩小我的代码,但我 运行 遇到了一些问题。我的文件结构如下:
/deploy
/assets
/js
((minified file goes here))
/js
script-compiled.js
我想 运行 UglifyJS on js/script-compiled.js
位于我的私人文件夹中,并让它在我的 deploy/js
中输出一个 script.min.js
文件(上传到的 js我的网站)文件夹。到目前为止,这是我的命令:
uglifyjs js/script-compiled.js --compress --mangle --screw-ie8 -o > deploy/assets/js/script.min.js
这给了我这个错误:
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string
我有点困惑。是否可以将文件输出到不同的目录?也许这只是一般的 Bash 事情。谢谢!
您指定了 -o
选项,但没有提供值。来自 docs:
-o filename
or --output filename
— put the result in filename. If this isn’t given, the result goes to standard output (or see next one).
所以要么
uglifyjs ... -o deploy/assets/js/script.min.js
或省略 -o
并重定向 stdout
uglifyjs ... > deploy/assets/js/script.min.js
我正在尝试使用 UglifyJS 来缩小我的代码,但我 运行 遇到了一些问题。我的文件结构如下:
/deploy
/assets
/js
((minified file goes here))
/js
script-compiled.js
我想 运行 UglifyJS on js/script-compiled.js
位于我的私人文件夹中,并让它在我的 deploy/js
中输出一个 script.min.js
文件(上传到的 js我的网站)文件夹。到目前为止,这是我的命令:
uglifyjs js/script-compiled.js --compress --mangle --screw-ie8 -o > deploy/assets/js/script.min.js
这给了我这个错误:
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string
我有点困惑。是否可以将文件输出到不同的目录?也许这只是一般的 Bash 事情。谢谢!
您指定了 -o
选项,但没有提供值。来自 docs:
-o filename
or--output filename
— put the result in filename. If this isn’t given, the result goes to standard output (or see next one).
所以要么
uglifyjs ... -o deploy/assets/js/script.min.js
或省略 -o
并重定向 stdout
uglifyjs ... > deploy/assets/js/script.min.js