Juned Lanja
Juned Lanja

Reputation: 1474

unable to create following folder structure in gulp?

I have project structure like this

-moduleA
   -styles
   -scripts

-moduleB
   -styles
   -scripts

-styles
-scripts

i want to get output so ending structure would like

-moduleA
   -styles
   -scripts

-moduleB
   -styles
   -scripts

-styles
-scripts

-build
   -moduleA
      -styles
      -scripts
   -moduleB
     -styles
     -scripts

Upvotes: 2

Views: 44

Answers (1)

agconti
agconti

Reputation: 18093

To copy folders and their contents to a new build folder simply use:

gulp.task('copy', function(){
  return gulp.src(['./moduleA', './moduleB'])
      .pipe(gulp.dest('./build')
})

You can do whatever processing you need to along the way by but specifying dependencies. ie:

gulp.task('transpile', function(){
  return gulp.src(['moduleA', 'moduleB'])
    .pipe(bable())
})

gulp.task('copy', function(){
  return gulp.src(['moduleA', 'moduleB'])
    .pipe(gulp.dest('./build')
})

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

Upvotes: 1

Related Questions