1

我使用最新的 PhpStorm 2017.2.3 和最新的 uglify.js。在我的工具设置 ID 中执行以下操作:

在此处输入图像描述

比我在模块目录中添加一个测试文件(test.js)并在里面获取一些代码:

function test () {
var messsage = 'hello world';
alert(messsage);
}

丑化结果是这样的:

function test(){var messsage="hello world";alert(messsage)}

该工具不会缩小代码,它只会把它放在一行中!我必须在设置中更改什么以缩小 js 代码?

4

1 回答 1

2

在docs中添加“参数:”的末尾:

-c -m

你会得到:

$FileName$ -o $FileNameWithoutExtension$.min.js -c -m

你的代码:

function test () {
  var messsage = 'hello world';
  alert(messsage);
}

将转变为:

function test(){alert("hello world")}
于 2018-04-01T12:58:56.857 回答