-2

here is gulp file and i am using bulid task to build all files and folder directory.... so my gulp build task not working properly....

I created three task for build final build directory - bulid:cleanfolder - build:copy - build:remove

gulp build task

/******************************************
bulid task
*******************************************/

// Clear out all files and folder from bulid folder
gulp.task('build:cleanfolder', function(cb){
  del([
      'build/**'
    ], cb);
});

// task to create build Directory for all files
gulp.task('build:copy', ['build:cleanfolder'], function(){
  return gulp.src('../atoz-website/*')
  .pipe(gulp.dest('build'));
});

// task to remove unwanted file into build Directory
gulp.task('build:remove', ['build:copy'], function(cb){
  del([
      'build/assets',
      'build/gulpfile.js',
      'build/package.json',
      'build/readme.md',
      'build/.gitignore'
    ], cb);
});

gulp.task('build', ['build:copy', 'build:remove']);

problem is only bulid:cleanfolder ruining but not others tasks!

xxxxxxxxxxx/xxxxxxxxxxx/atoz-website (new)
$ gulp build
[13:08:41] Using gulpfile D:\VE Work\Website\atoz-website\gulpfile.js
[13:08:41] Starting 'build:cleanfolder'...
Faizy
  • 69
  • 9

1 Answers1

0

Please see my answer on Copy/Deletion in Gulp randomly gives ENOENT

You'll need to install one additional plugin:

npm install vinyl-paths

Applying this to your gulpfile would look like:

var del = require('del');
var vinylPaths = require('vinyl-paths');

// Clear out all files and folder from build folder
gulp.task('build:cleanfolder', function(){
  return gulp.src(['build'])
    .pipe(vinylPaths(del));
});

// task to create build Directory for all files
gulp.task('build:copy', ['build:cleanfolder'], function(){
  return gulp.src('../atoz-website/*')
  .pipe(gulp.dest('build'));
});

// task to remove unwanted file into build Directory
gulp.task('build:remove', ['build:copy'], function(){
  return gulp.src([
      'build/assets',
      'build/gulpfile.js',
      'build/package.json',
      'build/readme.md',
      'build/.gitignore'
    ])
    .pipe(vinylPaths(del));
});

gulp.task('build', ['build:copy', 'build:remove']);
Community
  • 1
  • 1
Elger van Boxtel
  • 1,030
  • 12
  • 23
  • its not working still facing same issue! not calling anything just $ gulp build [14:33:34] Using gulpfile D:\VE Work\Website\atoz-website\gulpfile.js [14:33:34] Starting 'build:cleanfolder'... – Faizy Jan 18 '16 at 09:04
  • I just tried it and it seems to work. Try to remove your node_modules folder and do a fresh npm install. Which nodeJS version are you using? – Elger van Boxtel Jan 18 '16 at 09:09
  • nodejs version v0.12.7 i saw this video really good [Gulp Video Check on 38:47sec](https://www.youtube.com/watch?v=TE0U1RbTf1A&list=PLv1YUP7gO_viROuRcGsDCNM-FUVgMYb_G&index=3) – Faizy Jan 18 '16 at 09:40
  • Please do yourself a favor and update your nodeJS to version 5. Also please check that your gulp is at the latest version (gulp -v): which currently is 3.9.0 – Elger van Boxtel Jan 18 '16 at 09:45
  • gulp version [15:15:50] CLI version 3.9.0 [15:15:50] Local version 3.9.0 – Faizy Jan 18 '16 at 09:46
  • If you want something that works, you can also take a look at my project: https://github.com/elgervb/skeletonSPA – Elger van Boxtel Jan 18 '16 at 09:47
  • that great! but right now i am finding solution to build my folder! hope i will get solution – Faizy Jan 18 '16 at 13:30