title: Gradle minify all javascript
body: <p>I'm trying to minify all js files in my app. I was using <a href="https://github.com/eriwen/gradle-js-plugin" rel="nofollow noreferrer">gradle-js-plugin</a>. I was able to minify a single file using that. But I want my all js files to be minified. Here is what i tried. It may seem very dumb in the end, but I'm new to writing something with <strong>Gradle</strong>.</p>
  <pre><code>plugins {
  id &quot;com.eriwen.gradle.js&quot; version &quot;2.12.0&quot;
  }
  
  task minifyAll &lt;&lt; {
  
  FileTree tree = fileTree('src/main/webapp/resourcesMinified') {
      include '**/*.js'
      exclude '**/*.css'
      exclude '**/*.less'
      exclude '**/*.sass'
  }
  
  tree.each { file -&gt;
      def path = file.path
  
    minifyJs {
     println path
     source = path
     dest = path
     closure {
      warningLevel = 'QUIET'
     }
   }
  }
  </code></pre>
  <p>Problem is I can not invoke <code>minifyJs</code> task from inside <code>minifyAll</code>. I tried several things including <code>execute</code>.</p>