S.Chrobak
S.Chrobak

Reputation: 115

Minify javascript with Uglify and PhpStorm don't work

I use latest PhpStorm 2017.2.3 and latest uglify.js. In my Toolsettings id do this:

enter image description here

Than i add a testfile (test.js) in the module dir and take some code inside:

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

The uglify result is this:

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

The tool don't minified the code, it only bring it in one line! What i have to change in my settings to minify js-code?

Upvotes: 1

Views: 2614

Answers (1)

DmitriyK
DmitriyK

Reputation: 31

Add in the end of "Arguments:" from docs:

-c -m

and You'll get:

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

Your code:

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

will transform to:

function test(){alert("hello world")}

Upvotes: 3

Related Questions