Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt copy a single file

What is the format to specify a single file copy for grunt copy task

 copy:{
        dist:{
            files:[
               {
                    expand:true,
                    cwd:'<%= yeoman.app %>',
                    dest:'<%= yeoman.dist %>/scripts/jq.min.js',
                    src: ['components/jq/dist/jq.min.js']
                }
            ]

if my yeoman.app dir is A and yeoman.dist is B, this copies the file to

/b/scripts/jq.min.js/components/jq/dist/jq.min.js

what I want is copy it as /b/scripts/jq.min.js

how can I do this.

EDIT: I see an issue which implements the support. https://github.com/gruntjs/grunt-contrib-copy/issues/3

like image 700
bsr Avatar asked Jun 21 '13 20:06

bsr


2 Answers

Does this work?

copy: {
    dev: {
        files: [{
            cwd: '<%= yeoman.app %>/components/jq/dist/',
            src: 'jq.min.js',
            dest: '<%= yeoman.dist %>/scripts/',
            expand: true
        }]
    }
}
like image 81
Brian Lewis Avatar answered Sep 18 '22 07:09

Brian Lewis


Copy multiple source file locations to a single destination folder use flatten.

copy: {
    dev: {
        files: [{
            cwd: '<%= yeoman.app %>',
            src: ['/components/jq/dist/jq.min.js','/components/jq/dist/jq2.min.js', '/components/bs/dist/bs.js'],
            dest: '<%= yeoman.dist %>/scripts/',
            expand: true,
            flatten: true
        }]
    }
}
like image 44
Ryan M Avatar answered Sep 20 '22 07:09

Ryan M