giokokos
giokokos

Reputation: 622

Grunt copy task can not retain directory structure

I am using Bower to install the dependencies of my project and grab only the files I need with Grunt.js and copy them to the static to be served by the application.

One of them is the MathJax library but when I try to copy the whole folder (see the code below) it just ignores the directories and sprays all the files into the destination without handling the MathJax directory structure.

copy: {
    MathJax: {
        expand: true,
        flatten: true,
        cwd: 'bower_components/MathJax/',
        src: ['**'],
        dest: 'base/static/MathJax/'
    }
}

Is it a common bug on the copy task of Grunt or am I doing something wrong?

Upvotes: 2

Views: 2661

Answers (1)

Sindre Sorhus
Sindre Sorhus

Reputation: 63477

You're using the flatten options which does what it says; flattens the directory structure.

See docs: Building the files object dynamically

Upvotes: 7

Related Questions