angularjsnpmgruntjsgrunt-contrib-copy

grunt-contrib-copy is corrupting binary files


I am using the "grunt-contrib-copy": "^1.0.0" and the copied binary files are getting damaged, Please look at my grunt configuration and help me on this.

copy: {
    options: {
        // exclude binary format from the processContent function
        processContentExclude: [
            '**/*.{png,gif,jpg,ico,psd,ttf,otf,woff,svg}'
        ]
    },
    main: {
        files: [{
            expand: true,
            cwd: '<%= options.src %>',
            src: ['**/*.json', '**/*.htm*', '**/*.png'],
            dest: '<%= options.targets.dist %>'
        },
            {
                expand: true,
                cwd: '<%= options.resources %>',
                src: ['**/*.png'],
                dest: '<%= options.targets.dist %>',
                options: {
                    options: {
                        processContentExclude: ['**/*.{png,gif,jpg,ico,psd}']
                    }
                }
            }]
    }
},

Solution

  • In grunt-contrib-copy@1.0.0 the processContentExclude option has been renamed to noProcess. Your options object should be:

    // ...
    options: {
        // ...
        noProcess: [ // <-- Renamed from processContentExclude
            '**/*.{png,gif,jpg,ico,psd,ttf,otf,woff,svg}'
        ]
    },
    // ...
    

    I also assume that somewhere else in your configuration, (although not included in the OP), you might be using the processContent option - hence the corruption. Note, that the processContent option has been renamed to process so you'll need to rename that too. E.g.

    // ...
    options: {
        // ...
        process: function(foo, baz) { // <-- Renamed from processContent
            // ...          
        },
        // ...    
    }