0

Say I have this directory setup:

 +-- gruntfile.js
 |    
 +-- src/
 |  |  
 |  +-- lib/
 |     |
 |     +-- imgs/**
 |     |
 |     +-- js/**

And I want to create a distribution folder using grunt-contrib-copy:

 +-- gruntfile.js
 |    
 +-- app/
 |  |  
 |  +-- lib/
 |     |
 |     +-- imgs/**
 |     |
 |     +-- js/**
 |
 +-- src/**

Note that the src folder is not listed within the dist folder. So far, all my efforts end up like this:

 +-- gruntfile.js
 |    
 +-- app/
 |  |  
 |  +-- src/
 |     |
 |     +-- lib/
 |        |
 |        +-- imgs/**
 |        |
 |        +-- js/**
 +-- src/**

I've tried many different configurations, but here's the one I'm on currently:

{
  expand: true,
  src: ['src/lib/**'],
  dest: 'app/',
  flatten: false,
  filter: 'isFile'
}

Remember that I want to copy everything recursively below src into app, but without the src folder coming with it.

shennan
  • 10,798
  • 5
  • 44
  • 79

1 Answers1

0

Add the cwd property to your config and modify the src, so it looks like this:

{
  expand: true,
  cwd: 'src/',
  src: ['lib/**'],
  dest: 'app/',
  flatten: false,
  filter: 'isFile'
}
Matthew Bakaitis
  • 11,600
  • 7
  • 43
  • 53
  • Correct. Interestingly I did come across `cwd` and figured it would help; but I was still referencing the grunt directory within the `src` hash: `['src/lib/**']` - which was dim of me. Thanks. – shennan Nov 27 '14 at 00:30
  • Hardly "dim". The docs are vague and many plugins actually lack docs on what I consider core functions. – Matthew Bakaitis Nov 27 '14 at 01:05