title: How to use the Closure Compiler File Watcher in PHP Storm
body: <p>I am trying to get Google's closure compiler to work with PHP Storm for minifying javascript files.</p>
  <p>I'm not quite sure what i'm doing wrong trying to get this to work and I can't find any guides/tutorials on the web anywhere other than PHP Storm's own docs, which aren't specific enough.</p>
  <p>I installed closure compiler using &quot;npm install -g closurecompiler&quot;</p>
  <p>It placed it here: &quot;/usr/local/bin/ccjs&quot; (alias of &quot;/usr/local/lib/node_modules/closurecompiler/bin/ccjs&quot;)</p>
  <p>I then created my file watcher in php storm like so:</p>
  <p><img src="https://i.stack.imgur.com/BAEUq.png" alt="enter image description here" /></p>
  <p><a href="https://i.imgur.com/8bM3PLf.png" rel="nofollow noreferrer">Link to image</a></p>
  <p>Now when I save a JS file I get the following error:</p>
  <blockquote>
  <p>/usr/local/bin/ccjs --compilation_level SIMPLE_OPTIMIZATIONS --js common.js</p>
  <p>Illegal source file after options: SIMPLE_OPTIMIZATIONS</p>
  <p>Process finished with exit code 3</p>
  </blockquote>
  <p>With or without the SIMPLE_OPTIMIZATIONS option it gives an error.</p>
  <p>Presumably it simply can't locate the file i'm working with, possibly because of the path it's working from. But then my question is very, very simple, how do I specify the correct path?</p>
  <p>I have also tried specifying the exact path (and verified that it is correct) but I just get the same error.</p>
  <blockquote>
  <p>-compilation_level SIMPLE_OPTIMIZATIONS --js $ProjectFileDir$/public/themes/v2/js/$FileName$</p>
  </blockquote>
  <p>For comparison this works for my less file watcher without problem, so I thought $FileName$ would work without issue.</p>
  <blockquote>
  <p>--no-color --clean-css $FileName$</p>
  </blockquote>