N
N
nepster-web2015-08-14 00:01:00
JavaScript
nepster-web, 2015-08-14 00:01:00

grunt. How to copy folders using the copy task?

I use this task: https://github.com/gruntjs/grunt-contrib-copy
I pulled bootstrap to myself and I want to copy these folders to myself:

/bower_components/bootstrap/dist
/bower_components/bootstrap/fonts
/bower_components/bootstrap/js
/bower_components/bootstrap/less

Wrote the following problem:
{expand: true, flatten: true, src: [
  'bower_components/bootstrap/dist/*',
  'bower_components/bootstrap/fonts/*',
  'bower_components/bootstrap/js/*',
  'bower_components/bootstrap/less/*'
], dest: 'src/vendor/bootstrap/', filter: 'isFile'},

There was a problem, all files from these folders fly to src/vendor/bootstrap/ forming a dump.
If flatten is set to false, then this will fly:
src/vendor/bootstrap/bower_components/bootstrap/fonts
src/vendor/bootstrap/bower_components/bootstrap/js
src/vendor/bootstrap/bower_components/bootstrap/less

Ie extra nesting: bower_components/bootstrap/
In the course of inattention or not knowing English. language, I can not find in the docks what is the problem. How can I copy folders from one directory to another without unnecessary nesting?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Anikin, 2015-11-19
@nepster-web

{
     expand: true,
     cwd: 'bower_components/bootstrap',
     src: '**/*',
     dest: 'src/vendor/bootstrap/',
     filter: 'isFile'
  },

In general, all the salt in cwd

A
Alexey, 2015-09-13
@alexeyfedotof

Why even copy them? Write paths to bower_components and work. In any case, libraries are connected through bower to which it is not recommended to make changes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question