title: Gulp is not overwriting the destination file
body: <p>I've got a problem, regarding gulp. I decided to automate the process of how the source and styles are compiled into a single file, so I decided to use gulp for that purpose. However, it doesn't want to overwrite the <code>application.js</code> file that I'm creating from all <code>.js</code> files in my Project. The strange thing is that it actually overwrites the compiled css files, that is generated from all <code>.less</code> files in the Project.
  Here is how my Project file structure looks like:</p>
  
  <pre><code>.
  ├── gulpfile.js
  └── apps
      ├── base
          ├── controllers
              ├── controllerBaseOne.js
              └── controllerBaseTwo.js
          ├── directives
              ├── directiveBaseOne.js
              └── directiveBaseTwo.js
          ├── services
              └── serviceBaseOne.js
          └── styles
              └── styleBase.less
          ├── header.html
          └── index.html
      ├── services
          ├── compilation
              ├── application.js
              └── application.css
          ├── controllers
              ├── controllerServicesOne.js
              ├── controllerServicesTwo.js
              └── controllerServicesThree.js
          ├── directives
              ├── directiveServicesOne.js
              ├── directiveServicesTwo.js
              └── directiveServicesThree.js
          ├── services
              ├── serviceServicesOne.js
              └── serviceServicesTwo.js
          └── styles
              ├── styleServicesOne.less
              ├── styleServicesTwo.less
              └── styleServicesThree.less
          ├── header.html
          └── index.html
      ├── appMain.js
      └── config.json
  </code></pre>
  
  <p>Here is how my <code>gulpfile.js</code> looks now:</p>
  
  <pre><code>var gulp = require( "gulp" );
  var gulpif = require( "gulp-if" );
  var concat = require( "gulp-concat" );
  var uglify = require( "gulp-uglify" );
  var less = require( "gulp-less" );
  var cleanCSS = require( "gulp-clean-css" );
  
  // application components and paths:
  var compileMinify = false;
  var basePath = process.cwd() + "apps/base";
  var webPath = process.cwd() + "apps/services";
  var compilationPath = "compilation";
  var appCompiledFileName = "application";
  var stylePaths = [
      basePath + "/styles/**/*.less",
      webPath + "/styles/**/*.less"
  ];
  var sourcePaths = [
      basePath + "/**/*.js",
      webPath + "/**/*.js"
  ];
  
  gulp.task( "services-source", function() {
      return gulp.src( sourcePaths )
          .pipe( concat( appCompiledFileName + ".js" ) )
          .pipe( gulpif( compileMinify, uglify() ) )
          .pipe( gulp.dest( compilationPath, { cwd: webPath } ) );
  } );
  gulp.task( "services-styles", function() {
      return gulp.src( stylePaths )
          .pipe( concat( appCompiledFileName + ".less" ) )
          .pipe( less() )
          .pipe( gulpif( compileMinify, cleanCSS( { debug: true }, function( details ) {
              console.log( details.name + " original size: " + details.stats.originalSize );
              console.log( details.name + " minified size: " + details.stats.minifiedSize );
          } ) ) )
          .pipe( gulp.dest( compilationPath, { cwd: webPath } ) );
  } );
  gulp.task( "services", [ "services-source", "services-styles" ], function() {
      gulp.watch( sourcePaths, [ "services-source" ] );
      gulp.watch( stylePaths, [ "services-styles" ] );
  } );
  </code></pre>
  
  <p>As you can see, the gulp task <code>services-source</code> is going through each <code>.js</code> file in the <code>apps</code> folder and sub-folders, and concatenate all into a single file that should be put into <code>compilation</code> folder. Same is done in the <code>services-styles</code> task, just some less transformation is made. There is also a check to minify both styles and sources, but it's disabled by default for now.</p>
  
  <p>I tried adding at the end of the <code>services-source</code> task, where you put the destination of the complied file a parameter for overwriting like so: <code>overwrite: true</code>, but nothing seems to happen. When I run the <code>gulpfile.js</code> it makes just the <code>application.js</code> bigger and bigger each time - it's not overwriting it somehow.</p>
  
  <p>So, any advice what can be the cause of the problem? </p>